Re: Pagination

2017-06-21 Thread Vladimir Yudovin
Hi, can this https://docs.datastax.com/en/developer/java-driver/2.1/manual/paging/ help you? Best regards, Vladimir Yudovin, Winguzone - Cloud Cassandra Hosting On Wed, 21 Jun 2017 02:44:17 -0400 web master socketman2...@gmail.com wrote I am migrating from MySql to

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 see

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

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-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špor

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 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

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-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 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

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 al...@datastax.com wrote: On Tue, Feb 10, 2015 at 4:59 AM, Ajay ajay.ga...@gmail.com wrote: 1) Java

Re: Pagination support on Java Driver Query API

2015-02-10 Thread Alex Popescu
On Tue, Feb 10, 2015 at 4:59 AM, Ajay ajay.ga...@gmail.com 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

Re: pagination in cql3

2013-05-24 Thread Sylvain Lebresne
The short answer is yes, you can rely on the ordering of keys being consistent. They will always be returned in partitioner order. This is pretty much implied by the existence of the token() function so it's not going to change (if only because changing it would break people). -- Sylvain On

Re: Pagination over row Keys in Cassandra using Kundera/CQL queries

2013-01-14 Thread aaron morton
Its the same idea. If you want to get 50 columns ask for 51, iterate over the first 50 and use the 51st as the first column for the next page. If you get 51 column then you are at the end of the page. I've not used Kundera so cannot talk about specifics. Cheers - Aaron

Re: Pagination over row Keys in Cassandra using Kundera/CQL queries

2013-01-10 Thread Snehal Nagmote
Thank you Aaron , that link helps. However, In my application , I am using jpa(Kundera) to query cassandra. Is there a way to achieve this in cql or jpa query language? Thanks, Snehal On 9 January 2013 16:28, aaron morton aa...@thelastpickle.com wrote: Try this

Re: Pagination over row Keys in Cassandra using Kundera/CQL queries

2013-01-09 Thread aaron morton
Try this http://wiki.apache.org/cassandra/FAQ#iter_world Take a look at the code examples it points to. Cheers - Aaron Morton Freelance Cassandra Developer New Zealand @aaronmorton http://www.thelastpickle.com On 10/01/2013, at 11:55 AM, Snehal Nagmote

Re: Pagination

2012-11-27 Thread Derek Williams
Do you really require page numbers? I usually find them annoying while paging through a forum, especially if it is quite active. Threads from the bottom of the page get bumped to the next page so you end up seeing the same content again. I much prefer the first page being the current N results,

RE: Pagination

2012-11-27 Thread Sam Hodgson
causing problems. Cheers Sam Date: Tue, 27 Nov 2012 13:01:48 -0700 Subject: Re: Pagination From: de...@fyrie.net To: user@cassandra.apache.org Do you really require page numbers? I usually find them annoying while paging through a forum, especially if it is quite active. Threads from the bottom

Re: Pagination

2010-12-06 Thread Jonathan Ellis
Short answer: that's a bad idea; don't do it. Long answer: you could count 10 pages of results and jump there manually, which is what offset 10 * page_size is doing for you under the hood, but that gets slow quickly as your offset grows. Which is why you shouldn't do it with a SQL db either. On

Re: pagination through slices with deleted keys

2010-05-07 Thread Joost Ouwerkerk
+1. There is some disagreement on whether or not the API should return empty columns or skip rows when no data is found. In all of our use cases, we would prefer skipped rows. And based on how frequently new cassandra users appear to be confused about the current behaviour, this might be a more

Re: pagination through slices with deleted keys

2010-05-07 Thread Mike Malone
On Fri, May 7, 2010 at 5:29 AM, Joost Ouwerkerk jo...@openplaces.orgwrote: +1. There is some disagreement on whether or not the API should return empty columns or skip rows when no data is found. In all of our use cases, we would prefer skipped rows. And based on how frequently new

Re: pagination through slices with deleted keys

2010-05-06 Thread Mark Greene
Hey Ian, I actually just wrote a quick example of how to iterate over a CF that may have tombstones. This may help you out: http://markjgreene.wordpress.com/2010/05/05/iterate-over-entire-cassandra-column-family/ On Thu, May 6, 2010 at 12:17 PM, Ian Kallen spidaman.l...@gmail.com wrote: I read

Re: pagination through slices with deleted keys

2010-05-06 Thread Ian Kallen
Thanks Mark, great illustration. I'm already splitting my time developing directly with hector and a vastly simplified jython wrapper around it; I guess I'll address it at some wrapping layer (patch hector or let the jython layer deal). My grumpy editorial about this stuff is that on the

Re: pagination through slices with deleted keys

2010-05-06 Thread Mike Malone
Our solution at SimpleGeo has been to hack Cassandra to (optionally, at least) be sensible and drop Rows that don't have any Columns. The claim from the FAQ that Cassandra would have to check if there are any other columns in the row is inaccurate. The common case for us at least is that we're

Re: pagination through slices with deleted keys

2010-05-06 Thread Mike Malone
On Thu, May 6, 2010 at 3:27 PM, Ian Kallen spidaman.l...@gmail.com wrote: Cool, is this a patch you've applied on the server side? Are you running 0.6.x? I'm wondering if this kind of thing can make it into future versions of Cassandra. Yea, server side. It's basically doing the same thing