<?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 Re: update one hive table based on another table in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/update-one-hive-table-based-on-another-table/m-p/160020#M53331</link>
    <description>&lt;P&gt;Currently there is no way to do this.  Once there is a release that includes &lt;A href="https://issues.apache.org/jira/browse/HIVE-10924"&gt;HIVE-10924&lt;/A&gt; you will be able to do using Merge:&lt;/P&gt;&lt;PRE&gt;merge into z_test1 using z_test z on z_test1.LastName=z.LastName when matched then update set LastName=z.LastName;&lt;/PRE&gt;</description>
    <pubDate>Sat, 04 Feb 2017 03:43:25 GMT</pubDate>
    <dc:creator>ekoifman</dc:creator>
    <dc:date>2017-02-04T03:43:25Z</dc:date>
    <item>
      <title>update one hive table based on another table</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/update-one-hive-table-based-on-another-table/m-p/160017#M53328</link>
      <description>&lt;P&gt;I need to do an update of a column with values from another table&lt;/P&gt;&lt;P&gt;Step1:&lt;/P&gt;&lt;P&gt;execute(set hive.enforce.bucketing=true)by hadoop;&lt;/P&gt;&lt;P&gt;execute(set hive.exec.dynamic.partition.mode=nonstrict)by hadoop;&lt;/P&gt;&lt;P&gt;CREATE TABLE z_test1
(
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)
clustered by (City) into 3 buckets
stored as orc TBLPROPERTIES ('transactional'='true') &lt;/P&gt;&lt;P&gt;Step2:&lt;/P&gt;&lt;P&gt;Insert into z_test1 VALUES ("david","baker","houston","tx"),("rose","crab","houston","tx")&lt;/P&gt;&lt;P style="margin-left: 20px;"&gt;lastname    firstname    address      city
david           baker          houston       tx
rose            crab            houston        tx&lt;/P&gt;&lt;P&gt;Step3:&lt;/P&gt;&lt;P&gt;execute(set hive.enforce.bucketing=true)by hadoop;&lt;/P&gt;&lt;P&gt;execute(set hive.exec.dynamic.partition.mode=nonstrict)by hadoop;&lt;/P&gt;&lt;P&gt;CREATE TABLE z_test
(
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255),
country varchar(255)
)
clustered by (City) into 3 buckets
stored as orc TBLPROPERTIES ('transactional'='true') &lt;/P&gt;&lt;P&gt;Step4:&lt;/P&gt;&lt;P&gt;Insert into z_test VALUES ("david","burrows","houston","tx","usa")&lt;/P&gt;&lt;P&gt;lastname     firstname       address       city      country
david            burrows          houston       tx       usa&lt;/P&gt;&lt;P&gt;
Step5:&lt;/P&gt;&lt;P&gt;update z_test1 set FirstName= z.FirstName  from z_test z where z_test1.LastName= z.LastName&lt;/P&gt;&lt;P&gt;Error in step5 &lt;/P&gt;&lt;P&gt;Desired Result: davids first name in table z_test1 should be updated as burrows from second table&lt;/P&gt;&lt;P&gt;lastname firstname    address      city
david       burrows       houston      tx
rose        crab              houston       tx&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 11:00:55 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/update-one-hive-table-based-on-another-table/m-p/160017#M53328</guid>
      <dc:creator>ganeshkumar_mor</dc:creator>
      <dc:date>2022-09-16T11:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: update one hive table based on another table</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/update-one-hive-table-based-on-another-table/m-p/160018#M53329</link>
      <description>&lt;P&gt;This syntax is not supported in Hive.  The same can be achieve using SQL Merge statement which is implemented in &lt;A href="https://issues.apache.org/jira/browse/HIVE-10924" target="_blank"&gt;https://issues.apache.org/jira/browse/HIVE-10924&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Feb 2017 02:30:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/update-one-hive-table-based-on-another-table/m-p/160018#M53329</guid>
      <dc:creator>ekoifman</dc:creator>
      <dc:date>2017-02-04T02:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: update one hive table based on another table</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/update-one-hive-table-based-on-another-table/m-p/160019#M53330</link>
      <description>&lt;P&gt;H &lt;A rel="user" href="https://community.cloudera.com/users/1027/ekoifman.html" nodeid="1027"&gt;@Eugene Koifman&lt;/A&gt;i, I tried understanding the documentation you have provided but couldn't figure it out what you are saying, I want an hive working code which can replace this &lt;/P&gt;&lt;P&gt;update z_test1 set FirstName= z.FirstName from z_test z where z_test1.LastName= z.LastName&lt;/P&gt;</description>
      <pubDate>Sat, 04 Feb 2017 03:39:29 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/update-one-hive-table-based-on-another-table/m-p/160019#M53330</guid>
      <dc:creator>ganeshkumar_mor</dc:creator>
      <dc:date>2017-02-04T03:39:29Z</dc:date>
    </item>
    <item>
      <title>Re: update one hive table based on another table</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/update-one-hive-table-based-on-another-table/m-p/160020#M53331</link>
      <description>&lt;P&gt;Currently there is no way to do this.  Once there is a release that includes &lt;A href="https://issues.apache.org/jira/browse/HIVE-10924"&gt;HIVE-10924&lt;/A&gt; you will be able to do using Merge:&lt;/P&gt;&lt;PRE&gt;merge into z_test1 using z_test z on z_test1.LastName=z.LastName when matched then update set LastName=z.LastName;&lt;/PRE&gt;</description>
      <pubDate>Sat, 04 Feb 2017 03:43:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/update-one-hive-table-based-on-another-table/m-p/160020#M53331</guid>
      <dc:creator>ekoifman</dc:creator>
      <dc:date>2017-02-04T03:43:25Z</dc:date>
    </item>
    <item>
      <title>Re: update one hive table based on another table</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/update-one-hive-table-based-on-another-table/m-p/160021#M53332</link>
      <description>&lt;P&gt;you can use left join to get this&lt;/P&gt;&lt;P&gt;Step5 can be replace with&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create table z_test2 as &lt;/P&gt;&lt;P&gt;select a.LastName, &lt;/P&gt;&lt;P&gt;case when b.FirstName is null&lt;/P&gt;&lt;P&gt;then a.FirstName&lt;/P&gt;&lt;P&gt;else b.FirstName&lt;/P&gt;&lt;P&gt;end as firstname, &lt;/P&gt;&lt;P&gt;a.address, a.city&lt;/P&gt;&lt;P&gt;from z_test1 a left outer join z_test b&lt;/P&gt;&lt;P&gt;on a.LastName = b.LastName&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 00:41:34 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/update-one-hive-table-based-on-another-table/m-p/160021#M53332</guid>
      <dc:creator>ganeshkumar_mor</dc:creator>
      <dc:date>2017-03-02T00:41:34Z</dc:date>
    </item>
  </channel>
</rss>

