title: Reshape spark data frame of key-value pairs with keys as new columns
body: <p>I am new to spark and scala. Lets say I have a data frame of lists that are key value pairs. Is there a way to map the id vars of column ids as new columns?</p>
  
  <pre><code>df.show()
  +--------------------+--------------------  +
  | ids                | vals                 |
  +--------------------+--------------------  +
  |[id1,id2,id3]       | null                 |
  |[id2,id5,id6]       |[WrappedArray(0,2,4)] |
  |[id2,id4,id7]       |[WrappedArray(6,8,10)]|
  </code></pre>
  
  <p>Expected output:</p>
  
  <pre><code>+----+----+
  |id1 | id2| ...
  +----+----+
  |null| 0  | ...
  |null| 6  | ...
  </code></pre>