title: Collect rows as list with group by apache spark
body: <p>I have a particular use case where I have multiple rows for same customer where each row object looks like:</p>
  
  <pre><code>root
   -c1: BigInt
   -c2: String
   -c3: Double
   -c4: Double
   -c5: Map[String, Int]
  </code></pre>
  
  <p>Now I have do group by column c1 and collect all the rows as list for same customer like:</p>
  
  <pre><code>c1, [Row1, Row3, Row4]
  c2, [Row2, Row5]
  </code></pre>
  
  <p>I tried doing this ways
  <code>dataset.withColumn("combined", array("c1","c2","c3","c4","c5")).groupBy("c1").agg(collect_list("combined"))</code> but I get an exception:</p>
  
  <pre><code>Exception in thread "main" org.apache.spark.sql.AnalysisException: cannot resolve 'array(`c1`, `c2`, `c3`, `c4`, `c5`)' due to data type mismatch: input to function array should all be the same type, but it's [bigint, string, double, double, map&lt;string,map&lt;string,double&gt;&gt;];;
  </code></pre>