<?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: insert complex data in hive table in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/insert-complex-data-in-hive-table/m-p/222369#M184241</link>
    <description>&lt;P&gt;@Carlos Pascual &lt;/P&gt;&lt;P&gt;hi there,&lt;/P&gt;&lt;P&gt;you can add new values to the table by using update command... as i am giving an example,&lt;/P&gt;&lt;P&gt;UPDATE table_name&lt;BR /&gt;SET column1=value, column2=value2,...&lt;BR /&gt;WHERE some_column=some_value&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note: the WHERE clause in the UPDATE syntax:&lt;/STRONG&gt; The WHERE clause specifies which record or records that should be updated. If you omit the WHERE clause, all records will be updated! &lt;/P&gt;</description>
    <pubDate>Sat, 09 Dec 2017 16:07:21 GMT</pubDate>
    <dc:creator>22Sultan</dc:creator>
    <dc:date>2017-12-09T16:07:21Z</dc:date>
    <item>
      <title>insert complex data in hive table</title>
      <link>https://community.cloudera.com/t5/Support-Questions/insert-complex-data-in-hive-table/m-p/222368#M184240</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;I have created a table in hive like this:&lt;/P&gt;&lt;P&gt;create table if not exists TablaCatalogo1 (name string, species string, varietal string, provenance string,
toast string, process string, formatt array&amp;lt;string&amp;gt;) row format delimited fields terminated by ':' 
collection items terminated by ',' lines terminated by '\n';&lt;/P&gt;&lt;P&gt;in which formatt is a array of string. &lt;/P&gt;&lt;P&gt;Now, I want to insert a new value in this array for a certain product. I tried to use a dummy table to insert the value but I didn´t get. Any way to do it?&lt;/P&gt;&lt;P&gt;Thank you so much.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Dec 2017 07:34:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/insert-complex-data-in-hive-table/m-p/222368#M184240</guid>
      <dc:creator>carlospascual92</dc:creator>
      <dc:date>2017-12-09T07:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: insert complex data in hive table</title>
      <link>https://community.cloudera.com/t5/Support-Questions/insert-complex-data-in-hive-table/m-p/222369#M184241</link>
      <description>&lt;P&gt;@Carlos Pascual &lt;/P&gt;&lt;P&gt;hi there,&lt;/P&gt;&lt;P&gt;you can add new values to the table by using update command... as i am giving an example,&lt;/P&gt;&lt;P&gt;UPDATE table_name&lt;BR /&gt;SET column1=value, column2=value2,...&lt;BR /&gt;WHERE some_column=some_value&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note: the WHERE clause in the UPDATE syntax:&lt;/STRONG&gt; The WHERE clause specifies which record or records that should be updated. If you omit the WHERE clause, all records will be updated! &lt;/P&gt;</description>
      <pubDate>Sat, 09 Dec 2017 16:07:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/insert-complex-data-in-hive-table/m-p/222369#M184241</guid>
      <dc:creator>22Sultan</dc:creator>
      <dc:date>2017-12-09T16:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: insert complex data in hive table</title>
      <link>https://community.cloudera.com/t5/Support-Questions/insert-complex-data-in-hive-table/m-p/222370#M184242</link>
      <description>&lt;P&gt;You can create a data file with delimiters and use load command to load the data into table as mentioned in below example.&lt;/P&gt;&lt;P&gt;eg., create table test1(name string, age int, dept array&amp;lt;string&amp;gt;) row format delimited fields terminated by ':' collection items terminated by ',' stored as textfile;&lt;/P&gt;&lt;P&gt;Content in the text file should be delimited as follows &lt;/P&gt;&lt;P&gt;a:25:sales,marketing&lt;/P&gt;&lt;P&gt;b:26:dev,qa&lt;/P&gt;&lt;P&gt;... &lt;/P&gt;&lt;P&gt;name(string):age(int):dept(array&amp;lt;string&amp;gt; delimieted with ,) &lt;/P&gt;&lt;P&gt;0: jdbc:hive2://abcd:10000&amp;gt; load data inpath 'file_path' into table test1; &lt;/P&gt;&lt;P&gt;0: jdbc:hive2://abcd:10000&amp;gt; select * from test1; &lt;/P&gt;&lt;P&gt;+-----------+----------------+--------------------+--+ &lt;/P&gt;&lt;P&gt;| test1.name | test1.age | test1.dept | &lt;/P&gt;&lt;P&gt;+-----------+----------------+--------------------+--+ &lt;/P&gt;&lt;P&gt;| a | 25 | [sales,marketing] |&lt;/P&gt;&lt;P&gt;
| b | 26 | [dev,qa] |&lt;/P&gt;&lt;P&gt;
+-----------+----------------+--------------------+--+&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 13:25:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/insert-complex-data-in-hive-table/m-p/222370#M184242</guid>
      <dc:creator>nramanaiah</dc:creator>
      <dc:date>2017-12-11T13:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: insert complex data in hive table</title>
      <link>https://community.cloudera.com/t5/Support-Questions/insert-complex-data-in-hive-table/m-p/222371#M184243</link>
      <description>&lt;P&gt;Thank you so much!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 18:09:18 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/insert-complex-data-in-hive-table/m-p/222371#M184243</guid>
      <dc:creator>carlospascual92</dc:creator>
      <dc:date>2017-12-11T18:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: insert complex data in hive table</title>
      <link>https://community.cloudera.com/t5/Support-Questions/insert-complex-data-in-hive-table/m-p/222372#M184244</link>
      <description>&lt;P&gt;Glad to know that your problem is resolved. Can you please accept this answer.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 18:17:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/insert-complex-data-in-hive-table/m-p/222372#M184244</guid>
      <dc:creator>nramanaiah</dc:creator>
      <dc:date>2017-12-11T18:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: insert complex data in hive table</title>
      <link>https://community.cloudera.com/t5/Support-Questions/insert-complex-data-in-hive-table/m-p/222373#M184245</link>
      <description>&lt;P&gt;I think I didn´t explain my problem well. Apologies in advance. I will try to explain it well.&lt;/P&gt;&lt;P&gt;I have the next table:&lt;/P&gt;&lt;P style="margin-left: 20px;"&gt; create table test1(name string, age int, dept array&amp;lt;string&amp;gt;) row format delimited fields terminated by ':' collection items   terminated by ',' stored as textfile;&lt;/P&gt;&lt;P&gt;Now, I load this next file:&lt;/P&gt;&lt;P&gt;a:25:sales,marketing&lt;/P&gt;&lt;P&gt;b:26:dev,qa&lt;/P&gt;&lt;P&gt;With this file loaded, I want to update the table so that, for example, in the first line the array dept is [marketing, FINANCE].&lt;/P&gt;&lt;P&gt;I mean, I want to add a new value in this array.&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P style="margin-left: 20px;"&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 18:31:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/insert-complex-data-in-hive-table/m-p/222373#M184245</guid>
      <dc:creator>carlospascual92</dc:creator>
      <dc:date>2017-12-11T18:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: insert complex data in hive table</title>
      <link>https://community.cloudera.com/t5/Support-Questions/insert-complex-data-in-hive-table/m-p/222374#M184246</link>
      <description>&lt;P&gt;you can try below command for updating existing array data&lt;/P&gt;&lt;P&gt;If you want to overwrite existing value with new value for the array column, you can use below update statement&lt;/P&gt;&lt;P&gt;update test1 set dept=array('marketing', 'FINANCE') where name='a';&lt;/P&gt;&lt;P&gt;If you want to append new value, then you can use below update statement.&lt;/P&gt;&lt;P&gt;update test1 set dept=split(concat_ws(',',dept,'FINANCE'),',') where name ='a';&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 19:10:26 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/insert-complex-data-in-hive-table/m-p/222374#M184246</guid>
      <dc:creator>nramanaiah</dc:creator>
      <dc:date>2017-12-11T19:10:26Z</dc:date>
    </item>
  </channel>
</rss>

