You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Maxim Veksler <ma...@vekslers.org> on 2011/01/24 21:32:18 UTC

Range scan returns more results then expected (Using ByteOrderedPartitioner)

Hello,

Cassandra is configure as following:

conf/cassandra.yaml | grep 'partitioner:'
partitioner: org.apache.cassandra.dht.ByteOrderedPartitioner


Why yet doing range query on part of the key return more results then
expected (column, CF and keyspace names masked):


[default@KEYSPACE] list CF1[1_265_8_12:];
Using default limit of 100
-------------------
RowKey: 1_265_8_12_45
....
-------------------
RowKey: 1_265_8_12_46
....
-------------------
RowKey: 1_265_8_12_47
....
-------------------
RowKey: 1_265_8_12_48
....
-------------------
RowKey: 1_265_8_33_129
....
-------------------
RowKey: 1_265_8_33_130
....
-------------------
RowKey: 1_265_8_33_131
....
-------------------
RowKey: 1_265_8_33_132
....
-------------------
RowKey: 1_265_8_53_206
....
-------------------
RowKey: 1_265_8_53_207
....
-------------------
RowKey: 1_265_8_53_208
....
-------------------
RowKey: 1_265_8_53_209
....
-------------------
RowKey: 1_265_8_5_17
....
-------------------
RowKey: 1_265_8_5_18
....
-------------------
RowKey: 1_265_8_5_19
....
-------------------
RowKey: 1_265_8_5_20
....
-------------------
RowKey: 1_265_8_6_21
....
-------------------
RowKey: 1_265_8_6_22
....
-------------------
RowKey: 1_265_8_6_23
....
-------------------
RowKey: 1_265_8_6_24
....

20 Rows Returned.


I would expect only keys RowKey: *1_265_8_12*_45, *1_265_8_12*_46, *
1_265_8_12*_47, *1_265_8_12*_48 to be returned because they are the only
ones that (to my understanding) should match the pattern [*1_265_8_12*:].
What am I missing?

The same behavior happens both with cassandra-cli and hector...


Thank you,
Maxim.

Re: Range scan returns more results then expected (Using ByteOrderedPartitioner)

Posted by Maxim Veksler <ma...@vekslers.org>.
I see, now it makes perfect sense.

Thank you.

On Mon, Jan 24, 2011 at 11:05 PM, Aaron Morton <aa...@thelastpickle.com>wrote:

> It's not pattern matching, it's comparing / ordering the byte values. You
> are asking to return 100 keys in ascending order where the value of the key
> (after the partitioner has been applied) is greater than "1_265_8_12"
>
> If you want to do a seek and partial scan, you could use an end value in
> the list / get_range_slice (e.g. 1_265_8_13) or keep chunking data from the
> server without an end value and filter / test on the client side.
>
> Hope that helps.
> Aaron
>
> On 25 Jan, 2011,at 09:32 AM, Maxim Veksler <ma...@vekslers.org> wrote:
>
> Hello,
>
> Cassandra is configure as following:
>
> conf/cassandra.yaml | grep 'partitioner:'
> partitioner: org.apache.cassandra.dhtByteOrderedPartitioner
>
>
> Why yet doing range query on part of the key return more results then
> expected (column, CF and keyspace names masked):
>
>
> [default@KEYSPACE] list CF1[1_265_8_12:];
> Using default limit of 100
> -------------------
> RowKey: 1_265_8_12_45
> ....
> -------------------
> RowKey: 1_265_8_12_46
> ....
> -------------------
> RowKey: 1_265_8_12_47
> ....
> -------------------
> RowKey: 1_265_8_12_48
> ....
> -------------------
> RowKey: 1_265_8_33_129
> ....
> -------------------
> RowKey: 1_265_8_33_130
> ....
> -------------------
> RowKey: 1_265_8_33_131
> ....
> -------------------
> RowKey: 1_265_8_33_132
> ....
> -------------------
> RowKey: 1_265_8_53_206
> ....
> -------------------
> RowKey: 1_265_8_53_207
> ....
> -------------------
> RowKey: 1_265_8_53_208
> ....
> -------------------
> RowKey: 1_265_8_53_209
> ....
> -------------------
> RowKey: 1_265_8_5_17
> ....
> -------------------
> RowKey: 1_265_8_5_18
> ....
> -------------------
> RowKey: 1_265_8_5_19
> ....
> -------------------
> RowKey: 1_265_8_5_20
> ....
> -------------------
> RowKey: 1_265_8_6_21
> ....
> -------------------
> RowKey: 1_265_8_6_22
> ....
> -------------------
> RowKey: 1_265_8_6_23
> ....
> -------------------
> RowKey: 1_265_8_6_24
> ....
>
> 20 Rows Returned.
>
>
> I would expect only keys RowKey: *1_265_8_12*_45, *1_265_8_12*_46, *
> 1_265_8_12*_47, *1_265_8_12*_48 to be returned because they are the only
> ones that (to my understanding) should match the pattern [*1_265_8_12*:].
> What am I missing?
>
> The same behavior happens both with cassandra-cli and hector...
>
>
> Thank you,
> Maxim.
>
>

Re: Range scan returns more results then expected (Using ByteOrderedPartitioner)

Posted by Aaron Morton <aa...@thelastpickle.com>.
It's not pattern matching, it's comparing / ordering the byte values. You are asking to return 100 keys in ascending order where the value of the key (after the partitioner has been applied) is greater than "1_265_8_12" 

If you want to do a seek and partial scan, you could use an end value in the list / get_range_slice (e.g. 1_265_8_13) or keep chunking data from the server without an end value and filter / test on the client side. 

Hope that helps.
Aaron
 
On 25 Jan, 2011,at 09:32 AM, Maxim Veksler <ma...@vekslers.org> wrote:

Hello,

Cassandra is configure as following:

conf/cassandra.yaml | grep 'partitioner:'
partitioner: org.apache.cassandra.dht.ByteOrderedPartitioner


Why yet doing range query on part of the key return more results then expected (column, CF and keyspace names masked):


[default@KEYSPACE] list CF1[1_265_8_12:];
Using default limit of 100
-------------------
RowKey: 1_265_8_12_45
....
-------------------
RowKey: 1_265_8_12_46
....
-------------------
RowKey: 1_265_8_12_47
....
-------------------
RowKey: 1_265_8_12_48
....
-------------------
RowKey: 1_265_8_33_129
...
-------------------
RowKey: 1_265_8_33_130
....
-------------------
RowKey: 1_265_8_33_131
....
-------------------
RowKey: 1_265_8_33_132
....
-------------------
RowKey: 1_265_8_53_206
....
-------------------
RowKey: 1_265_8_53_207
....
-------------------
RowKey: 1_265_8_53_208
....
-------------------
RowKey: 1_265_8_53_209
....
-------------------
RowKey: 1_265_8_5_17
....
-------------------
RowKey: 1_265_8_5_18
....
-------------------
RowKey: 1_265_8_5_19
....
-------------------
RowKey: 1_265_8_5_20
....
-------------------
RowKey: 1_265_8_6_21
....
-------------------
RowKey: 1_265_8_6_22
....
-------------------
RowKey: 1_265_8_6_23
...
-------------------
RowKey: 1_265_8_6_24
....

20 Rows Returned.


I would expect only keys RowKey: 1_265_8_12_45, 1_265_8_12_46, 1_265_8_12_47, 1_265_8_12_48 to be returned because they are the only ones that (to my understanding) should match the pattern [1_265_8_12:]. What am I missing?

The same behavior happens both with cassandra-cli and hector...


Thank you,
Maxim.