title: Hive table Array Columns - explode using array_index
body: <p>Hi i have a Hive table </p>
  
  <pre><code>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&lt;string&gt;, 
  c array&lt;double&gt;, 
  d array&lt;double&gt; ) 
  ROW FORMAT DELIMITED FIELDS TERMINATED BY '~'  
  stored as textfile location 'user/riskfactor/data'; 
  </code></pre>
  
  <p>Here is my table data:  </p>
  
  <blockquote>
    <p>ID400S,["jms","jndi","jaxb","jaxn"],[100,200,300,400],[1,2,3,4]<br>
    ID200N,["one","two","three"],[212,352,418],[6,10,8]</p>
  </blockquote>
  
  <p>If i want to split array columns how can i split?<br>
  If i use explode function i can split array values for only one column  </p>
  
  <blockquote>
    <p>select explode(b) as b from riskfactor_table;</p>
  </blockquote>
  
  <p><strong>Output:</strong>  </p>
  
  <pre><code>jms  
  jndi  
  jaxb  
  jxn  
  one  
  two  
  three
  </code></pre>
  
  <p>But i want all the columns to be populated using one select statement below-  </p>
  
  <blockquote>
    <p>Query - select a,b,c,d from risk_factor;</p>
  </blockquote>
  
  <p><strong>Output:</strong>  </p>
  
  <pre><code>row1-  ID400S    jms    100    1  
  row2-  ID400S    jndi   200    2  
  row3-  ID400S    jaxb    300    3  
  row4-  ID400S    jaxn    400    4  
  </code></pre>
  
  <p>How can i populate all the data?  </p>