Cassandra 2.1, Spark 1.1, spark-cassandra-connector 1.1
I have a very very tall Column Family of key, value pairs. And I also have an RDD of keys that I'd like to select from that CF
What I'd like to do is something like
import com.datastax.spark.connector._
val ids = ...
val pairs = id.map{
id => sc.cassandraTable("cf", "tallTable")
.select("the_key", "the_val")
.where("the_key = ?", id)
}
However, referring to the the Spark Context in the map causes a NPE. I could make an RDD out of the full tallTable and then join on ids, however that is a very slow operation and I'd like to avoid it.
Is there a way to read a set of keys from Cassandra like this?