You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Selvam Raman <se...@gmail.com> on 2016/09/05 19:29:19 UTC
Cassandra timestamp to spark Date field
Hi All,
As per datastax report Cassandra to spark type
timestamp Long, java.util.Date, java.sql.Date, org.joda.time.DateTime
Please help me with your input.
I have a Cassandra table with 30 fields. Out of it 3 are timestamp.
I read cassandratable using sc.cassandraTable
[com.datastax.spark.connector.rdd.CassandraTableScanRDD[com.datastax.spark.connector.CassandraRow]
= CassandraTableScanRDD[9] at RDD at CassandraRDD.scala:15]
then I have converted to row of rdd
*val* exis_repair_fact = sqlContext.createDataFrame(rddrepfact.map(r =>
org.apache.spark.sql.Row.fromSeq(r.columnValues)),schema)
in schema fields I have mentioned timestamp as
*StructField*("shipped_datetime", *DateType*),
when I try to show the result, it throws java.util.Date can not convert to
java.sql.Date.
so how can I solve the issue.
First I have converted cassandrascanrdd to
--
Selvam Raman
"லஞ்சம் தவிர்த்து நெஞ்சம் நிமிர்த்து"