title: Spark-cassandra connector: select list of keys
body: <p>Cassandra 2.1, Spark 1.1, spark-cassandra-connector 1.1</p>
  
  <p>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</p>
  
  <p>What I'd like to do is something like </p>
  
  <pre><code>import com.datastax.spark.connector._                                    
  
  val ids = ...
  
  val pairs = id.map{
   id =&gt; sc.cassandraTable("cf", "tallTable")
          .select("the_key", "the_val")
          .where("the_key = ?", id)
   }
  </code></pre>
  
  <p>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. </p>
  
  <p>Is there a way to read a set of keys from Cassandra like this?</p>