<?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/union  two tables with different definition. in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Hive-Merge-union-two-tables-with-different-definition/m-p/212165#M174104</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've two tables in Hive which I want to merge/ union.&lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;Table A has an additional column p.&lt;/LI&gt;&lt;LI&gt;Table B doesn't have the column p.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;How can i merge both tables?&lt;/P&gt;</description>
    <pubDate>Thu, 08 Feb 2018 21:27:26 GMT</pubDate>
    <dc:creator>kashifamirbanga</dc:creator>
    <dc:date>2018-02-08T21:27:26Z</dc:date>
    <item>
      <title>Hive: Merge/union  two tables with different definition.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-Merge-union-two-tables-with-different-definition/m-p/212165#M174104</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've two tables in Hive which I want to merge/ union.&lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;Table A has an additional column p.&lt;/LI&gt;&lt;LI&gt;Table B doesn't have the column p.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;How can i merge both tables?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 21:27:26 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-Merge-union-two-tables-with-different-definition/m-p/212165#M174104</guid>
      <dc:creator>kashifamirbanga</dc:creator>
      <dc:date>2018-02-08T21:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: Hive: Merge/union  two tables with different definition.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-Merge-union-two-tables-with-different-definition/m-p/212166#M174105</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/66202/kashifamirbangash.html" nodeid="66202"&gt;@Kashif Amir&lt;/A&gt;&lt;P&gt;Cast the column p as null (or) some value and data types of the column p needs to match on both tables.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Example:-&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;hive# select cast("ta" as string)p
union
select cast("tb" as string)p;
+--------+--+
| p      |
+--------+--+
| ta     |
| tb     |
+--------+--+
&lt;/PRE&gt;&lt;P&gt;In the example i'm having 2 tables having same column name(p) and datatype(String) after doing union we are getting merged results.&lt;/P&gt;&lt;P&gt;(or)&lt;/P&gt;&lt;PRE&gt;select "i" op
union
select "ji" p;
+---------+--+
| op      |
+---------+--+
| i       |
| ji      |
+---------+--+



&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Feb 2018 21:49:41 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-Merge-union-two-tables-with-different-definition/m-p/212166#M174105</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2018-02-08T21:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: Hive: Merge/union  two tables with different definition.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-Merge-union-two-tables-with-different-definition/m-p/212167#M174106</link>
      <description>&lt;P&gt;Thank you, &lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929"&gt;@Shu&lt;/A&gt; !&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 22:23:41 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-Merge-union-two-tables-with-different-definition/m-p/212167#M174106</guid>
      <dc:creator>kashifamirbanga</dc:creator>
      <dc:date>2018-02-08T22:23:41Z</dc:date>
    </item>
  </channel>
</rss>

