Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 283989A16 for ; Tue, 24 Apr 2012 12:44:59 +0000 (UTC) Received: (qmail 54876 invoked by uid 500); 24 Apr 2012 12:44:56 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 54837 invoked by uid 500); 24 Apr 2012 12:44:56 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 54819 invoked by uid 99); 24 Apr 2012 12:44:55 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Apr 2012 12:44:55 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of tyler@datastax.com designates 209.85.217.172 as permitted sender) Received: from [209.85.217.172] (HELO mail-lb0-f172.google.com) (209.85.217.172) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Apr 2012 12:44:51 +0000 Received: by lbgc1 with SMTP id c1so508376lbg.31 for ; Tue, 24 Apr 2012 05:44:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:x-gm-message-state; bh=nhkaum4m6b1d+ARwmEgoQd94e7144k6lOZUQvv9LNAU=; b=PdziAp+XpG1pgkCy9lSsGAhDBuo+/8yNbMwrfiy6X+QBaLK1fUf04+pDVlrLH/bpQn CLy72FStIG8+eWDb1dlUQqjTL5byRtjvKqiNtAAiOvig2yLBFLK/5QQLPOpF9K1oMp0x GxAOeiFrHqm6Q+ZZuE39C2FiT6ru1XdD7P2nrvihB7axFaeIgGUk1b/a/w6191Rc79uk 1I4V9VLJRBpy+hxMu+KkCiCft+yA04aPxPOR/l0Z8twDzQf4E72b7FrV5kkqHGWE833T b7y5cOzC+SIlgl+VpILzF/LOhPRX6qCWW825wI9fKNVpbu98PtpiF8cv5jqurXgVljxh CETg== MIME-Version: 1.0 Received: by 10.112.41.5 with SMTP id b5mr9370436lbl.61.1335271469496; Tue, 24 Apr 2012 05:44:29 -0700 (PDT) Received: by 10.112.74.194 with HTTP; Tue, 24 Apr 2012 05:44:29 -0700 (PDT) In-Reply-To: References: Date: Tue, 24 Apr 2012 07:44:29 -0500 Message-ID: Subject: Re: Highest and lowest valid values for UUIDs/TimeUUIDs From: Tyler Hobbs To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=485b390f7b789e3a7c04be6c1d65 X-Gm-Message-State: ALoCoQnHQERaucBifHarD1956gaESAvXWTUWqmvpRKaHVvnJ2mqECJLxVNCK4/0pNffL4ZKbE5bA X-Virus-Checked: Checked by ClamAV on apache.org --485b390f7b789e3a7c04be6c1d65 Content-Type: text/plain; charset=ISO-8859-1 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 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 --485b390f7b789e3a7c04be6c1d65 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
At least for TimeUUIDs, this email I sent to cli= ent-dev@ a couple of weeks ago should help to explain things: ht= tp://www.mail-archive.com/client-dev@cassandra.apache.org/msg00125.html=

Looking at the linked pycassa code might be the most useful thing.
<= br>
On Tue, Apr 24, 2012 at 1:46 AM, Drew Kutchar= ian <drew@venarc.com> wrote:
Hi All,

Considering that UUIDs are compared as numbers in Java [1], what are the lo= west 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 va= lue in a composite column definition like Composite(UUID1, UUID2) where UUI= D1 can be set to the default value if not supplied. In addition, it'd b= e 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) {
=A0 =A0// The ordering is intentionally set up so that the UUIDs
=A0 =A0// can simply be numerically compared as two numbers
=A0 =A0return (this.mostSigBits < val.mostSigBits ? -1 :
=A0 =A0 =A0 =A0 =A0 =A0(this.mostSigBits > val.mostSigBits ? 1 :
=A0 =A0 =A0 =A0 =A0 =A0 (this.leastSigBits < val.leastSigBits ? -1 : =A0 =A0 =A0 =A0 =A0 =A0 =A0(this.leastSigBits > val.leastSigBits ? 1 :<= br> =A0 =A0 =A0 =A0 =A0 =A0 =A0 0))));
}




--
Tyler Hobbs
DataStax
<= br>
--485b390f7b789e3a7c04be6c1d65--