cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Drew Kutcharian <>
Subject Highest and lowest valid values for UUIDs/TimeUUIDs
Date Tue, 24 Apr 2012 06:46:38 GMT
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.



[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 :

View raw message