title: combine scala dataframe columns into single case class
body: <p>I have a dataframe that looks like this:</p>
  
  <pre><code>+--------+-----+--------------------+
  |     uid|  iid|               color|
  +--------+-----+--------------------+
  |41344966| 1305|                 red| 
  |41344966| 1305|               green|
  </code></pre>
  
  <p>I want to get to this as efficiently as possible:</p>
  
  <pre><code>+--------+--------------------+
  |     uid|     recommendations|
  +--------+--------------------+
  |41344966|      [[2174, red...|
  |41345063|    [[2174, green...|
  |41346177|   [[2996, orange...|
  |41349171|   [[2174, purple...|
  </code></pre>
  
  <p><code>res98: org.apache.spark.sql.Dataset[userRecs] = [uid: int, recommendations: array&lt;struct&lt;iid:int,color:string&gt;&gt;]</code></p>
  
  <p>So I want to group records by uid into an array of objects. Each object is a class with parameters iid and color.</p>
  
  <p><code>case class itemData (iid: Int, color: String)</code></p>
  
  <p><code>case class userRecs (uid: Int, recommendations: Array[itemData])</code></p>