cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lee Parker <...@socialagency.com>
Subject Re: [cassandra] sorting TimeUUID column?
Date Sun, 09 May 2010 13:44:03 GMT
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--
>
>

Mime
View raw message