title: Converting a Spark Dataframe to a Scala Map collection
body: <p>I'm trying to find the best solution to convert an entire Spark dataframe to a scala Map collection. It is best illustrated as follows:</p>
  
  <p>To go from this (in the Spark examples):</p>
  
  <pre><code>val df = sqlContext.read.json("examples/src/main/resources/people.json")
  
  df.show
  +----+-------+
  | age|   name|
  +----+-------+
  |null|Michael|
  |  30|   Andy|
  |  19| Justin|
  +----+-------+
  </code></pre>
  
  <p>To a Scala collection (Map of Maps) represented like this:</p>
  
  <pre><code>val people = Map(
  Map("age" -&gt; null, "name" -&gt; "Michael"),
  Map("age" -&gt; 30, "name" -&gt; "Andy"),
  Map("age" -&gt; 19, "name" -&gt; "Justin")
  )
  </code></pre>