cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Ellis <jbel...@gmail.com>
Subject Re: Question about TimeUUIDType
Date Mon, 26 Apr 2010 00:43:45 GMT
On Sun, Apr 25, 2010 at 5:40 PM, Tatu Saloranta <tsaloranta@gmail.com> wrote:
>> Now with TimeUUIDType, if two UUID have the same timestamps, they are ordered
>> by bytes order.
>
> Naively for the whole UUID? That would not be good, given that
> timestamp within UUID is not stored in expected lexical order, but
> with sort of little-endian mess (first bytes are least-significant
> bytes of timestamp).

I think the code here is clearer than explaining in English. :)

comparing timeuuids o1 and o2:

        long t1 = LexicalUUIDType.getUUID(o1).timestamp();
        long t2 = LexicalUUIDType.getUUID(o2).timestamp();
        return t1 < t2 ? -1 : (t1 > t2 ? 1 :
FBUtilities.compareByteArrays(o1, o2));

-Jonathan

Mime
View raw message