cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Ellis <jbel...@gmail.com>
Subject Re: Are row-keys sorted by the compareWith?
Date Fri, 18 Feb 2011 21:20:51 GMT
No.  CompareWith is for columns.

On Fri, Feb 18, 2011 at 3:16 PM, cbertu81@libero.it <cbertu81@libero.it> wrote:
> Hi all,
> I created a CF in which i need to get, sorted by time, the Rows inside. Each
> Row represents a comment.
>
> <ColumnFamily name="Comments" compareWith="TimeUUIDType" / >
>
> I've created a few rows using as Row Key a generated TimeUUID but when I call
> the Pelops method "GetColumnsFromRows" I don't get the data back as I expect:
> rows are not sorted by TimeUUID.
> I though it was probably cause of the random-part of the TimeUUID so I create
> a new CF ...
>
> <ColumnFamily name="Comments2" compareWith="LongType" / >
>
> This time I created a few rows using the java System.CurrentTimeMillis() that
> retrieve a long. I call again the "GetColumnsFromRows" and again the same
> results: data are not sorted!
> I've read many times that Rows are sorted as specified in the compareWith but
> I can't see it.
> To solve this problem for the moment I've used a SuperColumnFamily with an
> UNIQUE ROW ... but I think this is just a workaround and not the solution.
>
> <ColumnFamily name="Comments" type="Super" compareWith="TimeUUIDType"
> CompareSubcolumnsWith="BytesType"/ >
>
> Now when I call the "GetSuperColumnsFromRow" I get all the SuperColumns as I
> expected: sorted by TimeUUID. Why it does not happen the same with the Rows?
> I'm confused.
>
> TIA for any help.
>
> Best Regards
>
> Carlo
>



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com

Mime
View raw message