incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brandon Williams <dri...@gmail.com>
Subject Re: Model to store biggest score
Date Wed, 17 Mar 2010 16:10:11 GMT
On Wed, Mar 17, 2010 at 11:05 AM, Richard Grossman <richiesgr@gmail.com>wrote:

> Thanks, But what do you mean by ?
>
> pack a random integer after the score (so the sort order is maintained) in
>> big endian format and only examine the first 8 bytes of the column upon
>> retrieval.
>>
>> -Brandon
>>
>
> Do I need to take the score and add like -number like 100-1, 100-2, 100-3
> etc... to prevent collision ?
> Thanks
>

You have the score, which you pack in  big endian format, resulting in 8
bytes.  Then you generate a complete random number and pack it in big endian
format as well, resulting in another 8 bytes.  Now you concatenate the two
together (with the score first, to maintain sort order) and insert the
column.  When you retrieve it, you only look at the first 8 bytes to get the
score since the random number isn't important.

-Brandon

Mime
View raw message