Spark saving to Cassandra with Scala TTL Option -


i use cassandra spark connector in scala. here sample code working save data cassandra.

val data = rdd.map (f => new cassandrarow(indexedseq("pk", "count"), indexedseq(f._1, f._2.tostring())))  data.savetocassandra("keyspace", "table") 

then, try use ttl. here sample code adding ttl.

adding import

import com.datastax.spark.connector.writer.{ttloption, writeconf} 

and adding ttl savetocassandra

data.savetocassandra ("keyspace", "table", writeconf = writeconf(ttl = ttloption.constant(604800)) 

however, when compiled it, gets errors.

error messages

[error] bad symbolic reference. signature in ttloption.class refers term streaming [error] in package org.apache.spark not available. [error] may missing current classpath, or version on [error] classpath might incompatible version used when compiling ttloption.class. [error] 1 error found [error] (compile:compile) compilation failed [error] total time: 4 s, completed mar 31, 2015 11:55:14 

build.sbt

name := "cassandra"  version := "1.0"  scalaversion := "2.10.4"  librarydependencies += "org.apache.spark" % "spark-core_2.10" % "1.2.1"  librarydependencies += "org.apache.spark" % "spark-sql_2.10" % "1.2.1"  librarydependencies += "com.datastax.spark" % "spark-cassandra-connector_2.10" % "1.2.0-rc2" 

is there problem code??

this known bug in current connector relating dependency on streaming spark libraries.

https://datastax-oss.atlassian.net/browse/sparkc-113

if blocking , need workaround can include spark-streaming library dependency in build file.

librarydependencies += "org.apache.spark" % "spark-streaming_2.10" % "1.2.1" 

Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -