cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Wille <>
Subject Re: query contains IN on the partition key and an ORDER BY
Date Sat, 02 May 2015 19:20:42 GMT
Bag the IN clause and execute multiple parallel queries instead. It’s more performant anyway.

On May 2, 2015, at 11:46 AM, Abhishek Singh Bailoo <<>>


I have run into the following issue when
running a query (contains IN on the partition key and an ORDER BY ) using datastax driver
for Java.

However, I am able to run this query alright in cqlsh.

cqlsh:> show version;
[cqlsh 5.0.1 | Cassandra 2.1.2 | CQL spec 3.2.0 | Native protocol v3]

cqlsh:gps> select * from log where imeih in ('862170011627815@2015-01-29@03','862170011627815@2015-01-30@21','862170011627815@2015-01-30@04')
and dtime < '2015-01-30 23:59:59' order by dtime desc limit 1;

The same query when run via datastax Java driver gives the following error:

Exception in thread "main" com.datastax.driver.core.exceptions.InvalidQueryException: Cannot
page queries with both ORDER BY and a IN restriction on the partition key; you must either
remove the ORDER BY or the IN and sort client side, or disable paging for this query
    at com.datastax.driver.core.exceptions.InvalidQueryException.copy(

Any ideas?


View raw message