Convert a RDD into DataFrame after foreachRDD operation
<p>I am processing logs which using Spark Streaming. I parse the log and convert the logs into Java Map. Following is the code. 
Now I want to convert this Map into DataFrames
Any suggestion how achieve this? </p>

<pre><code>val sparkConf = new SparkConf().setAppName("StreamingApp").setMaster("local[2]")
sc = new SparkContext(sparkConf)
val ssc = new StreamingContext(sc, Seconds(2))
sqlContext= new SQLContext(sc)

val lines = ssc.textFileStream("hdfs://localhost:9000/test")
process(lines)


def process(lines: DStream[String]) {
 val maptorow = lines.foreachRDD(rdd=&gt;{
  rdd.map(line =&gt; getMap(line))
  .map(p =&gt;
  Row(p.get("column1"),
    p.get("column2"))    
    }) // how to get dataframe after this?


def getMap(logs: String): java.util.Map[String, Object] = {
    val k : java.util.Map[String, String] = parseLog(logs) 
}
}
</code></pre>

<p>Thanks</p>