Reputation: 1
How to paginate back from a 'n' th row key using RangeSlicesQuery ?
The data is based on RandomPartitioner and the reverse option on the setRange function seems to be applicable only for the columns not on the rows. (http://tinyurl.com/73tncn3)
Example :
row_key1
row_key2
row_key3
row_key4
row_key5
row_key6
Expected :
row_key3
row_key4
Recieved :
row_key1
row_key2
Received
row_key4
row_key5
Upvotes: 0
Views: 537
Reputation: 2866
When using the RandomPartitioner, the effective order in which Cassandra store the rows is random. Therefore you cannot do range slices in the way you expect.
What you should do is materialise your view in a row, and use some sort of calculated bucket for the row key. For example, the row key could be the the real row key / 10, and then the row could contain 10 real rows:
0 -> {row_key1 : v1, row_key2: v2, ...}
1 -> {row_key10: v10, row_key11: v11, ...}
and do on.
To do your query now, you do a get slice on row 0, from columns 'row_key4'...
Now you may ask, "what about my column keys"? For this you should use compound column names. For example, something that originally looked like this:
row_key1 -> {column1: v1, column2: v2, ...}
Would now look like this:
0 -> {[row_key1, column1]: v1, [row_key2, column2]: v2, ...}
and so on.
HTH
Tom
Upvotes: 1