title: Apache Spark: How do I convert a Spark DataFrame to a RDD with type RDD[(Type1,Type2, ...)]?
body: <p>For example, suppose I have the DataFrame:</p>
  
  <pre><code>var myDF = sc.parallelize(Seq(("one",1),("two",2),("three",3))).toDF("a", "b")
  </code></pre>
  
  <p>I can convert it to a <code>RDD[(String, Int)]</code> with a map:</p>
  
  <pre><code>var myRDD = myDF.map(r =&gt; (r(0).asInstanceOf[String], r(1).asInstanceOf[Int]))
  </code></pre>
  
  <p>Is there a better way to do this, maybe using the DF schema?</p>