When I try to save data in Cassandra (in Scala), I get the following exception:
java.lang.ClassCastException: com.datastax.driver.core.DefaultResultSetFuture cannot be discarded by com.google.common.util.concurrent.ListenableFuture
Please note that I do not get this error every time, but from time to time it happens randomly, which makes it more dangerous in production.
I am using YARN and I have shaded com.google. ** to avoid collision of the Guava character.
Here's the code snippet:
rdd.saveToCassandra(keyspace,"movie_attributes", SomeColumns("movie_id","movie_title","genre"))
Any help would be greatly appreciated.
UPDATE Adding information from the pom file as requested:
<dependency> <groupId>com.datastax.spark</groupId> <artifactId>spark-cassandra-connector_2.10</artifactId> <version>1.5.0</version> </dependency> <dependency> <groupId>com.datastax.spark</groupId> <artifactId>spark-cassandra-connector-java_2.10</artifactId> <version>1.5.0</version> </dependency> **Shading guava** <relocation> <pattern>com.google</pattern> <shadedPattern>oryx.com.google</shadedPattern> <includes> <include>com.google.common.**</include> </includes> </relocation>
Spark: 1.5.2 Cassandra Version: 2.2.3
scala apache-spark spark-cassandra-connector
neeraj baji
source share