Convert DataFrame to RDD[Map] in Scala
<p>I want to convert an array created like:</p>

<pre><code>case class Student(name: String, age: Int)
val dataFrame: DataFrame = sql.createDataFrame(sql.sparkContext.parallelize(List(Student("Torcuato", 27), Student("Rosalinda", 34))))
</code></pre>

<p>When I collect the results from the DataFrame, the resulting array is an  <code>Array[org.apache.spark.sql.Row] = Array([Torcuato,27], [Rosalinda,34])</code></p>

<p>I'm looking into converting the DataFrame in an RDD[Map] e.g:</p>

<pre><code>Map("name" -&gt; nameOFFirst, "age" -&gt; ageOfFirst)
Map("name" -&gt; nameOFsecond, "age" -&gt; ageOfsecond)
</code></pre>

<p>I tried to use map via: <code>x._1</code> but that does not seem to work for <code>Array [spark.sql.row]</code> How can I anyway perform the transformation?</p>