Reading data from Cassandra with Spark

119 views
Skip to first unread message

Yasemin Kaya

unread,
May 4, 2016, 9:30:48 AM5/4/16
to java-dri...@lists.datastax.com
Hi,

I have a data in Cassandra and want to get data to SparkRDD. I got an error , searched it but nothing changed. Is there anyone can help me to fix it? 
I can connect Cassandra and cqlsh there is no problem with them. 
I took code from datastax github page.

I am using 
Cassandra 3.5
spark: 1.5.2
cassandra-driver : 3.0.0
spark-cassandra-connector_2.10-1.5.0.jar
spark-cassandra-connector-java_2.10-1.5.0-M1.jar



--
hiç ender hiç

Reik Schatz

unread,
May 4, 2016, 9:52:22 AM5/4/16
to java-dri...@lists.datastax.com
The AbstractMethodError indicates some incompatibilities between your libraries. The 1.5.0-M1 jar actually depends on datastax-cassandra-driver 2.1.5. Any reason you are not using 1.5.0?

/Reik

--
You received this message because you are subscribed to the Google Groups "DataStax Java Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-us...@lists.datastax.com.

Yasemin Kaya

unread,
May 4, 2016, 10:10:57 AM5/4/16
to reik....@gmail.com, java-dri...@lists.datastax.com
I changed it to 1.5.0, and fixed the problem. 
Thank you very much.

Also when i add 
JavaRDD<Double> pricesRDD = javaFunctions(sc).cassandraTable("mykeyspace", "tablename", mapColumnTo(Double.class)).select("price");

mapColumnTo can not be recognized. The page says that

"The column mapper based row reader takes all the selected columns and maps them to some object with use of a given ColumnMapper. The corresponding factories can be easily obtained by series of mapRowTo overloaded methods. "

Best,
yasemin
--
hiç ender hiç

Kevin Gallardo

unread,
May 4, 2016, 12:00:08 PM5/4/16
to java-dri...@lists.datastax.com
Hello Yasemin, 


The method mapColumnTo() is static and located in the package com.datastax.spark.connector.japi.

So a :

import static com.datastax.spark.connector.japi.CassandraJavaUtil.mapColumnTo;

Should do it.

For further questions on the Spark connector, you may also want to consider the spark-cassandra-connector mailing list.

Cheers!
Kévin Gallardo.
Software Engineer in Drivers and Tools Team, at DataStax.

Reply all
Reply to author
Forward
0 new messages