title: How to embed spark dataframe columns to a map column?
body: <p>I have a spark dataframe with many many columns. Now, I want to combine them together to a map and build a new column.
  e.g.</p>
  
  <pre><code>col1:String col2:String col3:String... coln:String =&gt;
  col: Map(colname -&gt; colval)
  </code></pre>
  
  <p>One way to do this is to:</p>
  
  <pre><code>df.withColumn("newcol", struct(df.columns.head, df.columns.tail: _*))
  </code></pre>
  
  <p>However, I still have to convert df to <code>dataset</code>. I have no idea how to define the case class that can match <code>struct</code> type here.</p>
  
  <p>Another option is to embed columns to Map type, but I do not know how to express this.</p>