Hive - Split delimited columns over multiple rows, select based on position
<p>I'm Looking for a way to split the column based on comma delimited data.  Below is my dataset</p>

<pre><code>id  col1  col2
1   5,6   7,8
</code></pre>

<p>I want to get the result</p>

<pre><code>id col1 col2
1  5    7
1  6    8
</code></pre>

<p>The position of the index should match because I need to fetch results accordingly.</p>

<p>I tried the below query but it returns the cartesian product.</p>

<p><strong>Query</strong>:</p>

<pre><code>SELECT col3, col4
FROM test ext 
lateral VIEW explode(split(col1,'\002')) col1 AS col3
lateral VIEW explode(split(col2,'\002')) col2 AS col4
</code></pre>

<p><strong>Result</strong>:</p>

<pre><code>id col1 col2
1  5    7
1  5    8
1  6    7
1  6    8
</code></pre>