How to perform union on two DataFrames with different amounts of columns in Spark?
<p>I have 2 <code>DataFrame</code>s:</p>
<p><a href="https://i.stack.imgur.com/L4qs0.png" rel="noreferrer"><img src="https://i.stack.imgur.com/L4qs0.png" alt="Source data" /></a></p>
<p>I need union like this:</p>
<p><a href="https://i.stack.imgur.com/mdICY.png" rel="noreferrer"><img src="https://i.stack.imgur.com/mdICY.png" alt="enter image description here" /></a></p>
<p>The <code>unionAll</code> function doesn't work because the number and the name of columns are different.</p>
<p>How can I do this?</p>