<?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 table becomes all NULLs after add new columns in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Hive-table-becomes-all-NULLs-after-add-new-columns/m-p/354574#M236940</link>
    <description>&lt;P&gt;I have a hive table with three columns, delimited by tabs&lt;/P&gt;&lt;PRE&gt;hive (database)&amp;gt; describe formatted my_table;&lt;BR /&gt;# col_name data_type comment&lt;BR /&gt;field1 string &lt;BR /&gt;field2 string &lt;BR /&gt;field3 string&lt;BR /&gt;... ...&lt;BR /&gt;Storage Desc Params: &lt;BR /&gt;input.regex (\\S+)\\s+(\\S+)\\s+(.*)&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="x_s1 x_ContentPasted3"&gt;hive (&lt;SPAN&gt;database&lt;/SPAN&gt;)&amp;gt; select * from my_table limit 2;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="x_s1 x_ContentPasted3"&gt;DataX&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt; DataX&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt; DataX&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="x_s1 x_ContentPasted3"&gt;DataX&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt; DataX&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt; DataX&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;I want to add two new columns to the hive table schema, so I did:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;// add two columns&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;hive (database)&amp;gt; alter table my_table add columns(field4 string,field5 string);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;// add two more&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="x_ContentPasted4 x_ContentPasted5 x_ContentPasted6"&gt;(\\S+)\\s+ for the new columns&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;hive (database)&amp;gt; alter table my_table SET SERDEPROPERTIES ("input.regex" = "(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(.*)");&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;But seems it doesn't work with the old dataset (the old data file with three columns):&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="x_s1 x_ContentPasted3"&gt;hive (&lt;SPAN&gt;database&lt;/SPAN&gt;)&amp;gt; select * from my_table limit 2;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="x_s1 x_ContentPasted3"&gt;NULL&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="x_s1 x_ContentPasted3"&gt;NULL&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;I expected something like this:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="x_s1 x_ContentPasted3"&gt;DataX&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt; DataX&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt; DataX&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="x_s1 x_ContentPasted3"&gt;&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;DataX DataX&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt; DataX&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Could someone help me understand why all the fields show NULL after adding the columns to schema? Thanks in advance!&lt;/P&gt;</description>
    <pubDate>Wed, 12 Oct 2022 03:42:35 GMT</pubDate>
    <dc:creator>SwaggyPPPP</dc:creator>
    <dc:date>2022-10-12T03:42:35Z</dc:date>
    <item>
      <title>Hive table becomes all NULLs after add new columns</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-table-becomes-all-NULLs-after-add-new-columns/m-p/354574#M236940</link>
      <description>&lt;P&gt;I have a hive table with three columns, delimited by tabs&lt;/P&gt;&lt;PRE&gt;hive (database)&amp;gt; describe formatted my_table;&lt;BR /&gt;# col_name data_type comment&lt;BR /&gt;field1 string &lt;BR /&gt;field2 string &lt;BR /&gt;field3 string&lt;BR /&gt;... ...&lt;BR /&gt;Storage Desc Params: &lt;BR /&gt;input.regex (\\S+)\\s+(\\S+)\\s+(.*)&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="x_s1 x_ContentPasted3"&gt;hive (&lt;SPAN&gt;database&lt;/SPAN&gt;)&amp;gt; select * from my_table limit 2;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="x_s1 x_ContentPasted3"&gt;DataX&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt; DataX&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt; DataX&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="x_s1 x_ContentPasted3"&gt;DataX&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt; DataX&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt; DataX&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;I want to add two new columns to the hive table schema, so I did:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;// add two columns&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;hive (database)&amp;gt; alter table my_table add columns(field4 string,field5 string);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;// add two more&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="x_ContentPasted4 x_ContentPasted5 x_ContentPasted6"&gt;(\\S+)\\s+ for the new columns&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;hive (database)&amp;gt; alter table my_table SET SERDEPROPERTIES ("input.regex" = "(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(.*)");&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;But seems it doesn't work with the old dataset (the old data file with three columns):&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="x_s1 x_ContentPasted3"&gt;hive (&lt;SPAN&gt;database&lt;/SPAN&gt;)&amp;gt; select * from my_table limit 2;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="x_s1 x_ContentPasted3"&gt;NULL&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="x_s1 x_ContentPasted3"&gt;NULL&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;I expected something like this:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="x_s1 x_ContentPasted3"&gt;DataX&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt; DataX&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt; DataX&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="x_s1 x_ContentPasted3"&gt;&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;DataX DataX&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt; DataX&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;SPAN class="x_Apple-tab-span x_ContentPasted3"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;NULL&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Could someone help me understand why all the fields show NULL after adding the columns to schema? Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2022 03:42:35 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-table-becomes-all-NULLs-after-add-new-columns/m-p/354574#M236940</guid>
      <dc:creator>SwaggyPPPP</dc:creator>
      <dc:date>2022-10-12T03:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: Hive table becomes all NULLs after add new columns</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-table-becomes-all-NULLs-after-add-new-columns/m-p/355228#M237080</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/101092"&gt;@SwaggyPPPP&lt;/a&gt;&amp;nbsp;Is this a partitioned table? In that case you could run the &lt;A href="https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-Add/ReplaceColumns" target="_blank" rel="noopener"&gt;ALTER TABLE&lt;/A&gt;&amp;nbsp; command as follows:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;alter table my_table add columns(field4 string,field5 string) CASCADE;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;Let us know if this issue occurs consistently, after adding new columns, and your Cloudera product version?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 20:29:34 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-table-becomes-all-NULLs-after-add-new-columns/m-p/355228#M237080</guid>
      <dc:creator>smruti</dc:creator>
      <dc:date>2022-10-18T20:29:34Z</dc:date>
    </item>
  </channel>
</rss>

