cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From AJ Chen <ajc...@web2express.org>
Subject Re: [cassandra] sorting TimeUUID column?
Date Sun, 09 May 2010 16:32:12 GMT
setReversed(true) sorts timeUUID in descending order.  thanks, -aj

On Sun, May 9, 2010 at 6:44 AM, Lee Parker <lee@socialagency.com> wrote:

> You need to set the Reversed attribute on the sliceRange.  I don't know
> which library you are using, but it may be something like
> sliceRange.setReversed(true).
>
> Lee Parker
> On Sat, May 8, 2010 at 7:36 PM, AJ Chen <ajchen@web2express.org> wrote:
>
>> I have a column family for sorting time-uuid and expect to retrieve
>> columns in descending order (i.e. latest on the top). but the following
>> get_slice call returns column in ascending order.  Does cassandra sort
>> time-uuid column in descending order by default? Should get_slice call
>> return the most recent time-uuid?
>>
>>     <ColumnFamily CompareWith="TimeUUIDType" Name="Index"/>
>>
>>     ColumnParent columnParent = new ColumnParent(cf);
>>     SlicePredicate predicate = new SlicePredicate();
>>     SliceRange sliceRange = new SliceRange();
>>     sliceRange.setStart(new byte[] {});
>>     sliceRange.setFinish(new byte[] {});
>>     sliceRange.setCount(max);
>>     predicate.setSlice_range(sliceRange);
>>     return client.get_slice(keyspace, key, columnParent, predicate,
>> ConsistencyLevel.ONE);
>>
>> thanks,
>> -aj--
>>
>>
>


-- 
AJ Chen, PhD
Chair, Semantic Web SIG, sdforum.org
http://web2express.org
twitter @web2express
Palo Alto, CA, USA

Mime
View raw message