Thank You for the prompt response Eric.I'm new to Scala and Spark.Here is what I trying to do from my Json file.
{"table":"OGG_BDATA.BTEST","op_type":"I","op_ts":"2017-01-15 20:27:41.054429","current_ts":"2017-01-15T14:29:11.069000","pos":"00000000140000003414","after":{"ID":"1","CDATE":"2017-01-15:14:27:42","NAME":"aabbcc","C_FILE":"ddffgg"}}
{"table":"OGG_BDATA.BTEST","op_type":"I","op_ts":"2017-01-15 20:28:48.054429","current_ts":"2017-01-15T14:29:11.410000","pos":"00000000140000003583","after":{"ID":"2","CDATE":"2017-01-15:14:28:50","NAME":"aabbcc","C_FILE":"ddffgg"}}
{"table":"OGG_BDATA.BTEST","op_type":"U","op_ts":"2017-01-15 20:32:44.054377","current_ts":"2017-01-15T14:32:48.533000","pos":"00000000140000003900","before":{"ID":"2","CDATE":"2017-01-15:14:28:50","NAME":"aabbcc"},"after":{"ID":"2","CDATE":"2017-01-15:14:28:50","NAME":"aabbcc","C_FILE":"rreeff"}}
{"table":"OGG_BDATA.BTEST","op_type":"D","op_ts":"2017-01-15 20:33:58.054432","current_ts":"2017-01-15T14:34:03.579000","pos":"00000000140000004042","before":{"ID":"2","CDATE":"2017-01-15:14:28:50","NAME":"aabbcc"}}
{"table":"OGG_BDATA.BTEST","op_type":"I","op_ts":"2017-01-16 02:58:58.054389","current_ts":"2017-01-15T20:59:03.334000","pos":"00000000140000004194","after":{"ID":"3","CDATE":"2017-01-15:20:59:01","NAME":"aabbcc","C_FILE":"ddffgg"}}
val conf = new SparkConf(true).set("spark.cassandra.connection.host","10.0.0.203").set("spark.driver.allowMultipleContexts", "true")
val sc = new SparkContext(conf)
val sqlContext = new SQLContext(sc)
val df= sqlContext.read.json("file:///home/edureka/spark-1.5.2/jason.data")
val df1 = df.select(df("pos"),df("op_type"))
val df2 = Seq(df1.map {_.toSeq.map {_.toString}.toArray})
----> Can you help me here How to read that into RDD and saveToCassandra Table.(In this case,I will get 5 rows in Cassandra table)
My Cassandra table looks like below
select * from df_test;
-------------------------------------------------------------
pos | op_type
--------------------------------------------------------------------------
00000000140000003900 | U