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 prepares the statement, caches the query and return a query id (unique id) 3) Get the query id, offset and limit and return the set of rows according to the offset and limit and also return the last returned row offset. 4) Client make subsequent calls to the server with the offset returned by the server until all rows are returned. In case once call fails or times out, the client will make a call again. Below are the details I found: 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. 2) Using token() function on the clustering keys of the last returned row, we can skip the returned rows and using the LIMIT keyword, we can limit the number of rows. But the problem I see is that the token() function cannot be used if the query contains ORDER BY clause. Is there any other way to achieve the pagination support? Thanks Ajay