Re: Pagination support on Java Driver Query API

2015-02-13 Thread Ajay
The syntax suggested by Ondrej is not working in some case in 2.0.11 and logged an issue for the same. https://issues.apache.org/jira/browse/CASSANDRA-8797 Thanks Ajay On Feb 12, 2015 11:01 PM, "Bulat Shakirzyanov" < bulat.shakirzya...@datastax.com> wrote: > Fixed my Mail.app settings so you can

Re: Pagination support on Java Driver Query API

2015-02-12 Thread Bulat Shakirzyanov
Fixed my Mail.app settings so you can see my actual name, sorry. > On Feb 12, 2015, at 8:55 AM, DataStax wrote: > > Hello, > > As was mentioned earlier, the Java driver doesn’t actually perform pagination. > > Instead, it uses cassandra native protocol to set page size of the result > set. >

Re: Pagination support on Java Driver Query API

2015-02-12 Thread DataStax
Hello, As was mentioned earlier, the Java driver doesn’t actually perform pagination. Instead, it uses cassandra native protocol to set page size of the result set. (https://github.com/apache/cassandra/blob/trunk/doc/native_protocol_v2.spec#L699-L730

Re: Pagination support on Java Driver Query API

2015-02-12 Thread Eric Stevens
I don't know what the shape of the page state data is deep inside the JavaDriver, I've actually tried to dig into that in the past and understand it to see if I could reproduce it as a general purpose any-query kind of thing. I gave up before I fully understood it, but I think it's actually a hand

Re: Pagination support on Java Driver Query API

2015-02-12 Thread Eric Stevens
Thanks Ondřej! Definitely much easier. N/B, this is a new feature in 2.0.x, it will not work in 1.2.x. cqlsh:scratch> SELECT * FROM foo WHERE partitionkey = 1 and (ck1, ck2) > (1,2) limit 2; Bad Request: line 1:45 no viable alternative at input '(' On Thu, Feb 12, 2015 at 8:44 AM, Ondřej Nešpo

Re: Pagination support on Java Driver Query API

2015-02-12 Thread Ondřej Nešpor
There is a much easier way to do that (and I suppose the Java driver does it this way): page 1: SELECT * FROM foo WHERE partitionkey = 1 limit 2; partitionkey | ck1 | ck2 | col1 | col2 --+-+-+--+-- 1 | 1 | 3 |3 |3 1 | 1 | 2

Re: Pagination support on Java Driver Query API

2015-02-12 Thread Ajay
Thanks Eric. I figured out the same but didn't get time to put it on the mail. Thanks. But it is highly tied up to how data is stored internally in Cassandra. Basically how partition keys are used to distribute (less likely to change. We are not directly dependence on the partition algo) and clust

Re: Pagination support on Java Driver Query API

2015-02-12 Thread Eric Stevens
Your page state then needs to track the last ck1 and last ck2 you saw. Pages 2+ will end up needing to be up to two queries if the first query doesn't fill the page size. CREATE TABLE foo ( partitionkey int, ck1 int, ck2 int, col1 int, col2 int, PRIMARY KEY ((partitionkey), ck1, ck2) )

Re: Pagination support on Java Driver Query API

2015-02-11 Thread Ajay
Basically I am trying different queries with your approach. One such query is like Select * from mycf where condition on partition key order by ck1 asc, ck2 desc where ck1 and ck2 are clustering keys in that order. Here how do we achieve pagination support? Thanks Ajay On Feb 11, 2015 11:16 PM,

Re: Pagination support on Java Driver Query API

2015-02-11 Thread Ajay
Hi Eric, Thanks for your reply. I am using Cassandra 2.0.11 and in that I cannot append condition like last clustering key column > value of the last row in the previous batch. It fails Preceding column is either not restricted or by a non-EQ relation. It means I need to specify equal condition

Re: Pagination support on Java Driver Query API

2015-02-11 Thread Eric Stevens
> I can't believe that everyone read & process all rows at once (without pagination). Probably not too many people try to read all rows in a table as a single rolling operation with a standard client driver. But those who do would use token() to keep track of where they are and be able to resume

Re: Pagination support on Java Driver Query API

2015-02-10 Thread Ajay
Thanks Alex. But is there any workaround possible?. I can't believe that everyone read & process all rows at once (without pagination). Thanks Ajay On Feb 10, 2015 11:46 PM, "Alex Popescu" wrote: > > On Tue, Feb 10, 2015 at 4:59 AM, Ajay wrote: > >> 1) Java driver implicitly support Pagination

Re: Pagination support on Java Driver Query API

2015-02-10 Thread Alex Popescu
On Tue, Feb 10, 2015 at 4:59 AM, Ajay wrote: > 1) Java driver implicitly support Pagination in the ResultSet (using > Iterator) which can be controlled through FetchSize. But it is limited in a > way that we cannot skip or go previous. The FetchState is not exposed. Cassandra doesn't support sk

Pagination support on Java Driver Query API

2015-02-10 Thread Ajay
Hi, I am working on exposing the Cassandra Query APIs(Java Driver) as REST APIs for our internal project. To support Pagination, I looked at the Cassandra documentation, Source code and other forums. What I mean by pagination support is like below: 1) Client fires query to REST server 2) Server