title: How to use groupBy to collect rows into a map?
body: <p><strong>Context</strong></p>
  
  <pre><code>sqlContext.sql(s"""
  SELECT
  school_name,
  name,
  age
  FROM my_table
  """)
  </code></pre>
  
  <p><strong>Ask</strong></p>
  
  <p>Given the above table, I would like to group by school name and collect name, age into a <code>Map[String, Int]</code></p>
  
  <p><strong>For example - Pseudo-code</strong></p>
  
  <pre><code>val df = sqlContext.sql(s"""
  SELECT
  school_name,
  age
  FROM my_table
  GROUP BY school_name
  """)
  
  
  ------------------------
  school_name | name  | age
  ------------------------
  school A | "michael"| 7 
  school A | "emily"  | 5
  school B | "cathy"  | 10
  school B | "shaun"  | 5
  
  
  df.groupBy("school_name").agg(make_map)
  
  ------------------------------------
  school_name | map
  ------------------------------------
  school A    | {"michael": 7, "emily": 5}
  school B    | {"cathy": 10, "shaun": 5}
  </code></pre>