<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Hive MERGE Failure Due to Partition Column in SCD Type-2 Implementation in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Hive-MERGE-Failure-Due-to-Partition-Column-in-SCD-Type-2/m-p/413524#M254111</link>
    <description>&lt;P&gt;Dears,&lt;/P&gt;&lt;P&gt;The Hive MERGE is failing with the error below. Since &lt;STRONG&gt;yearmonth&lt;/STRONG&gt; is a partition column, implemented a Type-2 SCD script to track changes. However, even after including the partition column in the join condition, the same error persists.&lt;/P&gt;&lt;P&gt;Error while compiling statement: FAILED: SemanticException [Error 10007]: Ambiguous column reference deal_yearnumber in tgt.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Script&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;MERGE INTO accrued_interest_metric tgt&lt;BR /&gt;USING temp_ACCRUED_INTEREST_METRIC src&lt;BR /&gt;ON tgt.deal_number = src.deal_number&lt;BR /&gt;AND tgt.deal_metric_end_date = DATE '9999-12-31'&lt;BR /&gt;WHEN MATCHED&lt;BR /&gt;AND tgt.deal_hash &amp;lt;&amp;gt; src.deal_hash&lt;BR /&gt;THEN UPDATE SET&lt;BR /&gt;deal_metric_end_date = CURRENT_DATE - 1,&lt;BR /&gt;update_date = current_timestamp()&lt;BR /&gt;WHEN NOT MATCHED THEN&lt;BR /&gt;INSERT (&lt;BR /&gt;deal_number,&lt;BR /&gt;deal_metric_start_date,&lt;BR /&gt;deal_metric_end_date,&lt;BR /&gt;deal_branch_cd,&lt;BR /&gt;deal_type_cd,&lt;BR /&gt;deal_reference_number,&lt;BR /&gt;currency_cd,&lt;BR /&gt;deal_maturity_date,&lt;BR /&gt;deal_last_rollover_date,&lt;BR /&gt;deal_next_rollover_date,&lt;BR /&gt;deal_term_type_cd,&lt;BR /&gt;deal_accrued_interest_rate,&lt;BR /&gt;status_cd,&lt;BR /&gt;status_description,&lt;BR /&gt;deal_account_number,&lt;BR /&gt;deal_interset_account_number,&lt;BR /&gt;period_type_cd,&lt;BR /&gt;interset_type_cd,&lt;BR /&gt;deal_hash,&lt;BR /&gt;insert_date,&lt;BR /&gt;update_date,&lt;BR /&gt;deal_yyyymm&lt;BR /&gt;)&lt;BR /&gt;VALUES (&lt;BR /&gt;src.deal_number,&lt;BR /&gt;src.deal_metric_start_date,&lt;BR /&gt;src.deal_metric_end_date,&lt;BR /&gt;src.deal_branch_cd,&lt;BR /&gt;src.deal_type_cd,&lt;BR /&gt;src.deal_reference_number,&lt;BR /&gt;src.currency_cd,&lt;BR /&gt;src.deal_maturity_date,&lt;BR /&gt;src.deal_last_rollover_date,&lt;BR /&gt;src.deal_next_rollover_date,&lt;BR /&gt;src.deal_term_type_cd,&lt;BR /&gt;src.deal_accrued_interest_rate,&lt;BR /&gt;src.status_cd,&lt;BR /&gt;src.status_description,&lt;BR /&gt;src.deal_account_number,&lt;BR /&gt;src.deal_interset_account_number,&lt;BR /&gt;src.period_type_cd,&lt;BR /&gt;src.interset_type_cd,&lt;BR /&gt;src.deal_hash,&lt;BR /&gt;current_timestamp(),&lt;BR /&gt;current_timestamp(),&lt;BR /&gt;src.src_deal_yyyymm&lt;BR /&gt;);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 08 Feb 2026 12:47:23 GMT</pubDate>
    <dc:creator>APentyala</dc:creator>
    <dc:date>2026-02-08T12:47:23Z</dc:date>
    <item>
      <title>Hive MERGE Failure Due to Partition Column in SCD Type-2 Implementation</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-MERGE-Failure-Due-to-Partition-Column-in-SCD-Type-2/m-p/413524#M254111</link>
      <description>&lt;P&gt;Dears,&lt;/P&gt;&lt;P&gt;The Hive MERGE is failing with the error below. Since &lt;STRONG&gt;yearmonth&lt;/STRONG&gt; is a partition column, implemented a Type-2 SCD script to track changes. However, even after including the partition column in the join condition, the same error persists.&lt;/P&gt;&lt;P&gt;Error while compiling statement: FAILED: SemanticException [Error 10007]: Ambiguous column reference deal_yearnumber in tgt.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Script&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;MERGE INTO accrued_interest_metric tgt&lt;BR /&gt;USING temp_ACCRUED_INTEREST_METRIC src&lt;BR /&gt;ON tgt.deal_number = src.deal_number&lt;BR /&gt;AND tgt.deal_metric_end_date = DATE '9999-12-31'&lt;BR /&gt;WHEN MATCHED&lt;BR /&gt;AND tgt.deal_hash &amp;lt;&amp;gt; src.deal_hash&lt;BR /&gt;THEN UPDATE SET&lt;BR /&gt;deal_metric_end_date = CURRENT_DATE - 1,&lt;BR /&gt;update_date = current_timestamp()&lt;BR /&gt;WHEN NOT MATCHED THEN&lt;BR /&gt;INSERT (&lt;BR /&gt;deal_number,&lt;BR /&gt;deal_metric_start_date,&lt;BR /&gt;deal_metric_end_date,&lt;BR /&gt;deal_branch_cd,&lt;BR /&gt;deal_type_cd,&lt;BR /&gt;deal_reference_number,&lt;BR /&gt;currency_cd,&lt;BR /&gt;deal_maturity_date,&lt;BR /&gt;deal_last_rollover_date,&lt;BR /&gt;deal_next_rollover_date,&lt;BR /&gt;deal_term_type_cd,&lt;BR /&gt;deal_accrued_interest_rate,&lt;BR /&gt;status_cd,&lt;BR /&gt;status_description,&lt;BR /&gt;deal_account_number,&lt;BR /&gt;deal_interset_account_number,&lt;BR /&gt;period_type_cd,&lt;BR /&gt;interset_type_cd,&lt;BR /&gt;deal_hash,&lt;BR /&gt;insert_date,&lt;BR /&gt;update_date,&lt;BR /&gt;deal_yyyymm&lt;BR /&gt;)&lt;BR /&gt;VALUES (&lt;BR /&gt;src.deal_number,&lt;BR /&gt;src.deal_metric_start_date,&lt;BR /&gt;src.deal_metric_end_date,&lt;BR /&gt;src.deal_branch_cd,&lt;BR /&gt;src.deal_type_cd,&lt;BR /&gt;src.deal_reference_number,&lt;BR /&gt;src.currency_cd,&lt;BR /&gt;src.deal_maturity_date,&lt;BR /&gt;src.deal_last_rollover_date,&lt;BR /&gt;src.deal_next_rollover_date,&lt;BR /&gt;src.deal_term_type_cd,&lt;BR /&gt;src.deal_accrued_interest_rate,&lt;BR /&gt;src.status_cd,&lt;BR /&gt;src.status_description,&lt;BR /&gt;src.deal_account_number,&lt;BR /&gt;src.deal_interset_account_number,&lt;BR /&gt;src.period_type_cd,&lt;BR /&gt;src.interset_type_cd,&lt;BR /&gt;src.deal_hash,&lt;BR /&gt;current_timestamp(),&lt;BR /&gt;current_timestamp(),&lt;BR /&gt;src.src_deal_yyyymm&lt;BR /&gt;);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Feb 2026 12:47:23 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-MERGE-Failure-Due-to-Partition-Column-in-SCD-Type-2/m-p/413524#M254111</guid>
      <dc:creator>APentyala</dc:creator>
      <dc:date>2026-02-08T12:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: Hive MERGE Failure Due to Partition Column in SCD Type-2 Implementation</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-MERGE-Failure-Due-to-Partition-Column-in-SCD-Type-2/m-p/413590#M254151</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/111602"&gt;@APentyala&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This error is not caused by the SCD Type-2 logic or the MERGE syntax itself. The message &lt;EM&gt;“Ambiguous column reference deal_yearnumber in tgt”&lt;/EM&gt; usually indicates that the column exists more than once in the target table metadata.&lt;/P&gt;&lt;P&gt;Please check whether &lt;CODE&gt;deal_yearnumber&lt;/CODE&gt; (or the partition column) is defined both as a regular column and in the PARTITIONED BY section. Run &lt;CODE&gt;DESCRIBE FORMATTED&lt;/CODE&gt; and &lt;CODE&gt;SHOW CREATE TABLE&lt;/CODE&gt; to verify the schema.&lt;/P&gt;&lt;P&gt;If the column appears twice or was altered previously, Hive may treat it as ambiguous during MERGE compilation.&lt;/P&gt;&lt;P&gt;Recreating the table with a clean schema (ensuring the partition column is defined only once) typically resolves the issue.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Feb 2026 09:48:05 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-MERGE-Failure-Due-to-Partition-Column-in-SCD-Type-2/m-p/413590#M254151</guid>
      <dc:creator>RAGHUY</dc:creator>
      <dc:date>2026-02-24T09:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: Hive MERGE Failure Due to Partition Column in SCD Type-2 Implementation</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-MERGE-Failure-Due-to-Partition-Column-in-SCD-Type-2/m-p/413731#M254213</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/111602"&gt;@APentyala&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could be please let us know if the solution provided by&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/101097"&gt;@RAGHUY&lt;/a&gt;&amp;nbsp;fixed your problem? If you still face same issue, let me know so we can help you.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2026 21:49:12 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-MERGE-Failure-Due-to-Partition-Column-in-SCD-Type-2/m-p/413731#M254213</guid>
      <dc:creator>rsanchez</dc:creator>
      <dc:date>2026-03-17T21:49:12Z</dc:date>
    </item>
  </channel>
</rss>

