title: Hive Explode / Lateral View multiple arrays
body: <p>I have a hive table with the following schema: </p>
  
  <pre><code>COOKIE  | PRODUCT_ID | CAT_ID |    QTY    
  1234123   [1,2,3]    [r,t,null]  [2,1,null]
  </code></pre>
  
  <p>How can I normalize the arrays so I get the following result </p>
  
  <pre><code>COOKIE  | PRODUCT_ID | CAT_ID |    QTY
  
  1234123   [1]          [r]         [2]
  
  1234123   [2]          [t]         [1] 
  
  1234123   [3]          null       null 
  </code></pre>
  
  <p>I have tried the following: </p>
  
  <pre><code>select concat_ws('|',visid_high,visid_low) as cookie
  ,pid
  ,catid 
  ,qty
  from table
  lateral view explode(productid) ptable as pid
  lateral view explode(catalogId) ptable2 as catid 
  lateral view explode(qty) ptable3 as qty
  </code></pre>
  
  <p>however the result comes out as a Cartesian product.</p>