incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tyler Hobbs <ty...@datastax.com>
Subject Re: Highest and lowest valid values for UUIDs/TimeUUIDs
Date Tue, 24 Apr 2012 17:15:38 GMT
Yes, I have tested it.

On Tue, Apr 24, 2012 at 12:08 PM, Drew Kutcharian <drew@venarc.com> wrote:

> Thanks Tyler. So have you actually tried this with Cassandra?
>
>
>
> On Apr 24, 2012, at 5:44 AM, Tyler Hobbs wrote:
>
> At least for TimeUUIDs, this email I sent to client-dev@ a couple of
> weeks ago should help to explain things:
> http://www.mail-archive.com/client-dev@cassandra.apache.org/msg00125.html
>
> Looking at the linked pycassa code might be the most useful thing.
>
> On Tue, Apr 24, 2012 at 1:46 AM, Drew Kutcharian <drew@venarc.com> wrote:
>
>> Hi All,
>>
>> Considering that UUIDs are compared as numbers in Java [1], what are the
>> lowest and highest possible values a valid UUID can have? How about
>> TimeUUIDs?
>>
>> The reason I ask is that I would like to pick a "default" UUID value in a
>> composite column definition like Composite(UUID1, UUID2) where UUID1 can be
>> set to the default value if not supplied. In addition, it'd be nice if the
>> "default" columns are always sorted before the rest of the columns.
>>
>> I was thinking of just doing "new UUID(Long.MAX_VALUE, Long.MAX_VALUE)"
>> or "new UUID(Long.MIN_VALUE, Long.MIN_VALUE)" but not sure if that's going
>> to cause other issues that I'm not aware of.
>>
>> Thanks,
>>
>> Drew
>>
>>
>> [1] Here's the compareTo of java.util.UUID as a reference:
>>
>> public int compareTo(UUID val) {
>>    // The ordering is intentionally set up so that the UUIDs
>>    // can simply be numerically compared as two numbers
>>    return (this.mostSigBits < val.mostSigBits ? -1 :
>>            (this.mostSigBits > val.mostSigBits ? 1 :
>>             (this.leastSigBits < val.leastSigBits ? -1 :
>>              (this.leastSigBits > val.leastSigBits ? 1 :
>>               0))));
>> }
>>
>>
>
>
> --
> Tyler Hobbs
> DataStax <http://datastax.com/>
>
>
>


-- 
Tyler Hobbs
DataStax <http://datastax.com/>

Mime
View raw message