2

I'm trying to save data from Spark to Cassandra in Scala using saveToCassandra for an RDD or save with a dataframe (both result in the same error). The full message is:

java.lang.ClassCastException: com.datastax.driver.core.DefaultResultSetFuture cannot be cast to com.google.common.util.concurrent.ListenableFuture

I've followed along with the code here and still seem to get the error.

I'm using Cassandra 3.6, Spark 1.6.1, and spark-cassandra-connector 1.6. Let me know if there's anything else I can provide to help with the debugging.

1 Answer 1

1

I had similar exception and fixed it after changing in build.sbt scala version:

scalaVersion := "2.10.6"

and library dependencies:

libraryDependencies ++= Seq(
  "com.datastax.spark" %% "spark-cassandra-connector" % "1.6.0",
  "com.datastax.cassandra" % "cassandra-driver-core" % "3.0.2",
  "org.apache.spark" %% "spark-core" % "1.6.1" % "provided",
  "org.apache.spark" %% "spark-sql" % "1.6.1" % "provided"
)

With this configuration example from 5-minute quick start guide works fine.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks, this helped fix the issue. One of the main problems I was having is conflicting guava versions so if anyone comes across this error in the future I would look into that. I wasn't able to solve it without putting the code into different projects, but I imagine there's a way without doing this (shading perhaps? I don't know enough about it...).
@grzesiekw I too had the same problem. your library informations saved me. thanks
connector 1.6.0 depends on C* driver 3.0.0 if you check the branch source. I wonder why C* driver 3.0.2 is explicitly needed here. Also it's an interesting decision for Datastax to make breaking changes from 3.0.0 to 3.0.2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.