You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by A J <s5...@gmail.com> on 2012/03/16 22:29:42 UTC

Order rows numerically

If I define my rowkeys to be Integer
(key_validation_class=IntegerType) , how can I order the rows
numerically ?
ByteOrderedPartitioner orders lexically and retrieval using get_range
does not seem to make sense in order.

If I were to change rowkey to be UTF8 (key_validation_class=UTF8Type),
BOP still does not give numerical enough.
For range of rowkey from 1 to 2, I get 1, 10,11.....,2 (lexical ordering).

Any workaround for this ?

Thanks.

Re: Order rows numerically

Posted by Dave Brosius <db...@mebigfatguy.com>.
if your keys are 1-n and you are using BOP, then almost certainly your 
ring will be massively unbalanced with the first node getting clobbered. 
You'll have bigger issues than getting lexical ordering.

I'd try to rethink your design so that you don't need BOP.

On 03/16/2012 06:49 PM, Watanabe Maki wrote:
> How about to fill zeros before smaller digits?
> Ex. 00000001, 00000002, etc
>
> maki
>
>
> On 2012/03/17, at 6:29, A J<s5...@gmail.com>  wrote:
>
>> If I define my rowkeys to be Integer
>> (key_validation_class=IntegerType) , how can I order the rows
>> numerically ?
>> ByteOrderedPartitioner orders lexically and retrieval using get_range
>> does not seem to make sense in order.
>>
>> If I were to change rowkey to be UTF8 (key_validation_class=UTF8Type),
>> BOP still does not give numerical enough.
>> For range of rowkey from 1 to 2, I get 1, 10,11.....,2 (lexical ordering).
>>
>> Any workaround for this ?
>>
>> Thanks.


Re: Order rows numerically

Posted by A J <s5...@gmail.com>.
Yes, that is good enough for now. Thanks.

On Fri, Mar 16, 2012 at 6:49 PM, Watanabe Maki <wa...@gmail.com> wrote:
> How about to fill zeros before smaller digits?
> Ex. 00000001, 00000002, etc
>
> maki
>
>
> On 2012/03/17, at 6:29, A J <s5...@gmail.com> wrote:
>
>> If I define my rowkeys to be Integer
>> (key_validation_class=IntegerType) , how can I order the rows
>> numerically ?
>> ByteOrderedPartitioner orders lexically and retrieval using get_range
>> does not seem to make sense in order.
>>
>> If I were to change rowkey to be UTF8 (key_validation_class=UTF8Type),
>> BOP still does not give numerical enough.
>> For range of rowkey from 1 to 2, I get 1, 10,11.....,2 (lexical ordering).
>>
>> Any workaround for this ?
>>
>> Thanks.

Re: Order rows numerically

Posted by Watanabe Maki <wa...@gmail.com>.
How about to fill zeros before smaller digits?
Ex. 00000001, 00000002, etc

maki


On 2012/03/17, at 6:29, A J <s5...@gmail.com> wrote:

> If I define my rowkeys to be Integer
> (key_validation_class=IntegerType) , how can I order the rows
> numerically ?
> ByteOrderedPartitioner orders lexically and retrieval using get_range
> does not seem to make sense in order.
> 
> If I were to change rowkey to be UTF8 (key_validation_class=UTF8Type),
> BOP still does not give numerical enough.
> For range of rowkey from 1 to 2, I get 1, 10,11.....,2 (lexical ordering).
> 
> Any workaround for this ?
> 
> Thanks.