title: Combine multiple columns into single column in SPARK
body: <p>I have a flattened incoming data in the below format in my parquet file:</p>
  <p><a href="https://i.stack.imgur.com/7iT0C.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7iT0C.png" alt="enter image description here" /></a></p>
  <p>I want to convert it into the below format where I am non-flattening my structure:</p>
  <p><a href="https://i.stack.imgur.com/wS5is.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wS5is.png" alt="enter image description here" /></a></p>
  <p>I tried the following:</p>
  <pre><code>Dataset&lt;Row&gt; rows = df.select(col(&quot;id&quot;), col(&quot;country_cd&quot;),
                  explode(array(&quot;fullname_1&quot;, &quot;fullname_2&quot;)).as(&quot;fullname&quot;),
                  explode(array(&quot;firstname_1&quot;, &quot;firstname_2&quot;)).as(&quot;firstname&quot;));
  </code></pre>
  <p>But it gives the below error:</p>
  <p><em>Exception in thread &quot;main&quot; org.apache.spark.sql.AnalysisException: Only one generator allowed per select clause but found 2: explode(array(fullname_1, fullname_2)), explode(array(firstname_1, firstname_2));</em></p>
  <p>I understand it is because you cannot use more than 1 explode in a query.
  I am looking for options to do the above in Spark Java.</p>