I use Cassandra 2.1.7
and CQL3
for processing it.
I have a column of type list<text>
in my table. I use DataStax cassandra-driver-core-2.1.5
to read and write my data from Cassandra
. While building of my query, I saw that the query that was building for my column list<text>
was wrong.(I checked both the query's in Datastax DevCenter
)
My code to build query.
Clause clause = null;
for (Entry<String, Object> val : conditionMap.entrySet()) {
clause = QueryBuilder.eq("\"".concat(val.getKey()).concat("\""), val.getValue());
where = where.and(clause);
}
The Query that build while I use the above method.
SELECT * FROM "ashokkeyspace"."table150" WHERE "id"=150 AND "listdata" =['apple'];
What query that I actually required.
SELECT * FROM "ashokkeyspace"."table150" WHERE "id"=150 AND "listdata" contains 'apple';
UPDATE: 2.1.7 dropped today
Looks like this is supported as of the driver version 2.1.7.
Which is not yet officially released / documented.
But you can build yourself or hold off until it is GA.
I recommend waiting before pushing to Prod because there are some known performance issues with the current 2.1.7 branch.
You want the new ContainsClause
in the query builder.
For updates on release dates etc. see the driver mailing list.