java - Spark Cassandra connector filtering with IN clause -


i facing issues spark cassandra connector filtering java. cassandra allows filtering last column of partition key in clause. e.g

create table cf_text (a varchar,b varchar,c varchar, primary key((a,b),c))  query : select * cf_text ='asdf' , b in ('af','sd');  sc.cassandratable("test", "cf_text").where("a = ?", "af").toarray.foreach(println) 

how count specify in clause used in cql query in spark? how range queries can specified well?

just wondering, spark code above work? thought spark won't allow where on partition keys (a , b in case), since uses them under hood (see last answer question): spark datastax java api select statements

in case, cassandra spark connector, allowed stack where clauses, , in can specified list<string>.

list<string> valueslist = new arraylist<string>(); valueslist.add("value2"); valueslist.add("value3");  sc.cassandratable("test", "cf")     .where("column1 = ?", "value1")     .where("column2 in ?", valueslist)     .keyby(new function<mycfclass, string>() {                 public string call(mycfclass _mycf) throws exception {                     return _mycf.getid();                 }             }); 

note normal rules of using in cassandra/cql still apply here.

range queries function in similar manner:

sc.cassandratable("test", "person")     .where("age > ?", "15")     .where("age < ?", "20")     .keyby(new function<person, string>() {                 public string call(person _person) throws exception {                     return _person.getpersonid();                 }             }); 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -