<?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 Explode with array_index with no Cartesian product in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hive-Explode-with-array-index-with-no-Cartesian-product/m-p/163932#M29383</link>
    <description>&lt;P&gt;Hi i have a Hive table &lt;/P&gt;&lt;PRE&gt;

Hi i have a Hive table 
select a,b,c,d from riskfactor_table 
In the above table B, C and D columns are array columns. Below is my Hive DDL 
Create external table riskfactor_table 
(a string, 
b array&amp;lt;string&amp;gt;, 
c array&amp;lt;double&amp;gt;, 
d array&amp;lt;double&amp;gt; ) 
ROW FORMAT DELIMITED FIELDS TERMINATED BY '~'  
stored as textfile location 'user/riskfactor/data';  


Here is my table data:
ID400S,["jms","jndi","jaxb","jaxn"],[100,200,300,400],[1,2,3,4]
ID200N,["one","two","three"],[212,352,418],[6,10,8]
If i want to split array columns how can i split?
If i use explode function i can split array values for only one column
select explode(b) as b from riskfactor_table;
Output:
jms
jndi
jaxb
jxn
one
two
three
But i want all the columns to be populated using one select statement below-
Query - select a,b,c,d from risk_factor;
Output:
row1- ID400S jms 100 1
row2- ID400S jndi 200 2
row3- ID400S jaxb 300 3
row4- ID400S jaxn 400 4
How can i populate all the data?

&lt;/PRE&gt;</description>
    <pubDate>Tue, 24 May 2016 07:26:50 GMT</pubDate>
    <dc:creator>saisatish13</dc:creator>
    <dc:date>2016-05-24T07:26:50Z</dc:date>
    <item>
      <title>Hive Explode with array_index with no Cartesian product</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hive-Explode-with-array-index-with-no-Cartesian-product/m-p/163932#M29383</link>
      <description>&lt;P&gt;Hi i have a Hive table &lt;/P&gt;&lt;PRE&gt;

Hi i have a Hive table 
select a,b,c,d from riskfactor_table 
In the above table B, C and D columns are array columns. Below is my Hive DDL 
Create external table riskfactor_table 
(a string, 
b array&amp;lt;string&amp;gt;, 
c array&amp;lt;double&amp;gt;, 
d array&amp;lt;double&amp;gt; ) 
ROW FORMAT DELIMITED FIELDS TERMINATED BY '~'  
stored as textfile location 'user/riskfactor/data';  


Here is my table data:
ID400S,["jms","jndi","jaxb","jaxn"],[100,200,300,400],[1,2,3,4]
ID200N,["one","two","three"],[212,352,418],[6,10,8]
If i want to split array columns how can i split?
If i use explode function i can split array values for only one column
select explode(b) as b from riskfactor_table;
Output:
jms
jndi
jaxb
jxn
one
two
three
But i want all the columns to be populated using one select statement below-
Query - select a,b,c,d from risk_factor;
Output:
row1- ID400S jms 100 1
row2- ID400S jndi 200 2
row3- ID400S jaxb 300 3
row4- ID400S jaxn 400 4
How can i populate all the data?

&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 May 2016 07:26:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hive-Explode-with-array-index-with-no-Cartesian-product/m-p/163932#M29383</guid>
      <dc:creator>saisatish13</dc:creator>
      <dc:date>2016-05-24T07:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Hive Explode with array_index with no Cartesian product</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hive-Explode-with-array-index-with-no-Cartesian-product/m-p/163933#M29384</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/10668/saisatish13.html" nodeid="10668"&gt;@Sai Satish&lt;/A&gt; you can achieve it in this way&lt;/P&gt;&lt;PRE&gt;create table aTable(a int,b array&amp;lt;String&amp;gt;);insert into table aTable select 1,array('a','b') from dummyTable;hive&amp;gt; select * from aTable;
OK
1["a","b"]
1["a","b"]
select a,expl_tbl from aTable LATERAL VIEW explode(b) exploded_table as expl_tbl;
Query ID = hive_20160524053317_27cb538e-43e1-436f-8744-ec53a0c9d3b2
Total jobs = 1
Launching Job 1 out of 1
Status: Running (Executing on YARN cluster with App id application_1463989024283_0004)
--------------------------------------------------------------------------------
VERTICES STATUS TOTAL COMPLETED RUNNING PENDING FAILED KILLED
--------------------------------------------------------------------------------
Map 1 .......... SUCCEEDED 1 1 0 0 0 0
--------------------------------------------------------------------------------
VERTICES: 01/01 [==========================&amp;gt;&amp;gt;] 100% ELAPSED TIME: 3.25 s
--------------------------------------------------------------------------------
OK
1a
1b
1a
1b
Time taken: 4.765 seconds, Fetched: 4 row(s)

&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 May 2016 12:36:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hive-Explode-with-array-index-with-no-Cartesian-product/m-p/163933#M29384</guid>
      <dc:creator>rajkumar_singh</dc:creator>
      <dc:date>2016-05-24T12:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: Hive Explode with array_index with no Cartesian product</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hive-Explode-with-array-index-with-no-Cartesian-product/m-p/163934#M29385</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thank you for your reply.&lt;/P&gt;&lt;P&gt;I am looking for multiple array columns solution.What if my table contains more than one array column if i use Lateral view explode in my Hive query it results Cartesian product.&lt;/P&gt;&lt;P&gt;If i have &lt;/P&gt;&lt;P&gt;10 array values in my Column1, &lt;/P&gt;&lt;P&gt;10 array values in Column2,&lt;/P&gt;&lt;P&gt;10 array values in Column3 &lt;/P&gt;&lt;P&gt;then the result will be 1000 rows &lt;/P&gt;&lt;P&gt;which is wrong.I want the &lt;/P&gt;&lt;P&gt;result output also 10 rows. &lt;/P&gt;&lt;P&gt;I was checking in stack overflow (http://stackoverflow.com/questions/20667473/hive-explode-lateral-view-multiple-arrays) &lt;/P&gt;&lt;P&gt;i got some info using array_index and brickhouse jar we can do it but when i run the similar query in my Hive its not working. I am using Hive version is - 1.2.1&lt;/P&gt;&lt;P&gt;Any help ?&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 22:05:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hive-Explode-with-array-index-with-no-Cartesian-product/m-p/163934#M29385</guid>
      <dc:creator>saisatish13</dc:creator>
      <dc:date>2016-05-24T22:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Hive Explode with array_index with no Cartesian product</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hive-Explode-with-array-index-with-no-Cartesian-product/m-p/163935#M29386</link>
      <description>&lt;P&gt;thanks for reply&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2016 19:54:51 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hive-Explode-with-array-index-with-no-Cartesian-product/m-p/163935#M29386</guid>
      <dc:creator>akkran23</dc:creator>
      <dc:date>2016-12-09T19:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: Hive Explode with array_index with no Cartesian product</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hive-Explode-with-array-index-with-no-Cartesian-product/m-p/163936#M29387</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/14818/akkran23.html" nodeid="14818"&gt;@akshay singh&lt;/A&gt; &lt;A rel="user" href="https://community.cloudera.com/users/10668/saisatish13.html" nodeid="10668"&gt;@Sai Satish&lt;/A&gt; I am also facing same issue. Were you able to solve this?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jul 2018 19:31:02 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Hive-Explode-with-array-index-with-no-Cartesian-product/m-p/163936#M29387</guid>
      <dc:creator>ankitbansal1988</dc:creator>
      <dc:date>2018-07-05T19:31:02Z</dc:date>
    </item>
  </channel>
</rss>

