title: Spark GroupBy agg collect_list multiple columns
body: <p>I have a question similar to <a href="https://stackoverflow.com/questions/42850554/apache-spark-dataframe-groupby-agg-for-multiple-columns/42850745">this</a> but the number of columns to be operated by collect_list is given by a name list. For example:</p>
  
  <pre><code>scala&gt; w.show
  +---+-----+----+-----+
  |iid|event|date|place|
  +---+-----+----+-----+
  |  A|   D1|  T0|   P1|
  |  A|   D0|  T1|   P2|
  |  B|   Y1|  T0|   P3|
  |  B|   Y2|  T2|   P3|
  |  C|   H1|  T0|   P5|
  |  C|   H0|  T9|   P5|
  |  B|   Y0|  T1|   P2|
  |  B|   H1|  T3|   P6|
  |  D|   H1|  T2|   P4|
  +---+-----+----+-----+
  
  
  scala&gt; val combList = List("event", "date", "place")
  combList: List[String] = List(event, date, place)
  
  scala&gt; val v = w.groupBy("iid").agg(collect_list(combList(0)), collect_list(combList(1)), collect_list(combList(2)))
  v: org.apache.spark.sql.DataFrame = [iid: string, collect_list(event): array&lt;string&gt; ... 2 more fields]
  
  scala&gt; v.show
  +---+-------------------+------------------+-------------------+
  |iid|collect_list(event)|collect_list(date)|collect_list(place)|
  +---+-------------------+------------------+-------------------+
  |  B|   [Y1, Y2, Y0, H1]|  [T0, T2, T1, T3]|   [P3, P3, P2, P6]|
  |  D|               [H1]|              [T2]|               [P4]|
  |  C|           [H1, H0]|          [T0, T9]|           [P5, P5]|
  |  A|           [D1, D0]|          [T0, T1]|           [P1, P2]|
  +---+-------------------+------------------+-------------------+
  </code></pre>
  
  <p>Is there any way I can apply collect_list to multiple columns inside agg without knowing the number of elements in the combList prior?</p>