title: How to convert RDD[CassandraRow] to DataFrame?
body: <p>Currently this is how I am transforming Cassandrarow RDD to dataframe:</p>
  
  <pre><code>val ssc = new StreamingContext(sc, Seconds(15))
  
  val dstream = new ConstantInputDStream(ssc, ssc.cassandraTable("db", "table").select("createdon"))
  
  import sqlContext.implicits._
  
  dstream.foreachRDD{ rdd =&gt;
      val dataframeJobs = rdd.map(w =&gt; (w.dataAsString)).map(_.split(":")).map(x =&gt;(x(1))).map(_.split(" ")).map(x =&gt;(x(1))).toDF("ondate")
  }
  </code></pre>
  
  <p>As you can see, I am converting first cassandraRow rdd to string first, and then mapping to the format I want. I find this method to get complicated as when the rdd contains multiple coloumns instead of just one (createdon) as shown in the example.</p>
  
  <p>Is there any other alternative and easy way to convert cassandraRow RDD to dataframe?</p>
  
  <p>My build.sbt is as follows:</p>
  
  <pre><code>scalaVersion := "2.11.8"
  
  libraryDependencies ++= Seq(
    "com.datastax.spark" %% "spark-cassandra-connector" % "2.0.1",
    "org.apache.spark" %% "spark-core" % "2.0.2" % "provided",
    "org.apache.spark" %% "spark-sql" % "2.0.2",
    "org.apache.spark" %% "spark-streaming" % "2.0.2"
  )
  </code></pre>