Spark Scala: retrieve the schema and store it
<p>Is it possible to retrieve the schema of an RDD and store it in a variable? Because I want to create a new data frame from another RDD using the same schema. For example, below is what I am hoping to have:</p>

<pre><code>val schema = oldDF.getSchema()
val newDF = sqlContext.createDataFrame(rowRDD, schema)
</code></pre>

<p>Assuming I already have <code>rowRDD</code> in the format of <code>RDD[org.apache.spark.sql.Row]</code> , is this something possible?</p>