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 9DAE57F77 for ; Mon, 18 Jul 2011 22:37:44 +0000 (UTC) Received: (qmail 65743 invoked by uid 500); 18 Jul 2011 22:37:42 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 65589 invoked by uid 500); 18 Jul 2011 22:37:42 -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 65581 invoked by uid 99); 18 Jul 2011 22:37:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jul 2011 22:37:41 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of nate@datastax.com designates 209.85.216.44 as permitted sender) Received: from [209.85.216.44] (HELO mail-qw0-f44.google.com) (209.85.216.44) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jul 2011 22:37:34 +0000 Received: by qwc23 with SMTP id 23so2937074qwc.31 for ; Mon, 18 Jul 2011 15:37:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.68.200 with SMTP id w8mr5761182qci.114.1311028632775; Mon, 18 Jul 2011 15:37:12 -0700 (PDT) Received: by 10.229.75.77 with HTTP; Mon, 18 Jul 2011 15:37:12 -0700 (PDT) X-Originating-IP: [64.132.24.216] In-Reply-To: References: Date: Mon, 18 Jul 2011 17:37:12 -0500 Message-ID: Subject: Re: Creating comparator of (Dynamic)CompositeType with cassandra-cli From: Nate McCall To: user@cassandra.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Your comparator is looking for the empty string as the first component. For what you are trying to do, you probably want the TimeUUID to be first so you can specify the range for the first positions, then "" and "|" (or similarly brute-ish ascii search hack which would include all the values of this comparator) for the composites in the 2nd position (start and end respectively). This would give you the timeUUID range. On Mon, Jul 18, 2011 at 2:19 PM, Anthony Ikeda wrote: > It's okay, it seems that you need to enclose the comparator with single > quotes..... > > On another note, can ranges be set without based on just one components o= f a > composite column name? > > I have a the Composite below in the previous email and want to return all= my > transaction columns for a particular date range: > > public Set findTransactions(String listId, long startTim= e, > long endTime) { > =A0=A0=A0 =A0=A0=A0 DynamicCompositeSerializer ds =3D new DynamicComposit= eSerializer(); > =A0=A0=A0=A0=A0=A0=A0 SliceQuery transQ= uery =3D > HFactory.createSliceQuery(getKeyspace(), mStringSerializer, ds, > mStringSerializer); > =A0=A0=A0=A0=A0=A0=A0 transQuery.setKey(listId); > =A0=A0=A0=A0=A0=A0=A0 transQuery.setColumnFamily(CF_TRANSACTIONS); > =A0=A0=A0=A0=A0=A0=A0 DynamicComposite startRange =3D null; > =A0=A0=A0=A0=A0=A0=A0 DynamicComposite endRange =3D null; > > =A0=A0=A0=A0=A0=A0=A0 if (startTime > 0) { > =A0=A0=A0=A0=A0=A0=A0 =A0=A0=A0 mLog.debug("Setting startRange with start= Time[" + startTime + > "]"); > =A0=A0=A0=A0=A0=A0=A0 =A0=A0=A0 startRange =3D new DynamicComposite("", n= ewTimeUUID(startTime)); > =A0=A0=A0=A0=A0=A0=A0 } else { > =A0=A0=A0=A0=A0=A0=A0 =A0=A0=A0 mLog.debug("Setting startRange to beginni= ng of time!"); > =A0=A0=A0=A0=A0=A0=A0 =A0=A0=A0 startRange =3D new DynamicComposite("", n= ew UUID(0, 0)); > =A0=A0=A0=A0=A0=A0=A0 } > > =A0=A0=A0 =A0=A0=A0 if (startTime > 0 && endTime > 0) { > =A0=A0=A0=A0=A0=A0=A0 =A0=A0=A0 mLog.debug("Setting startRange with endTi= me[" + endTime + "]"); > =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 endRange =3D new DynamicComposite("", newTi= meUUID(endTime)); > =A0=A0=A0 =A0=A0=A0 } else { > =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 mLog.debug("Setting endRange to end of time= !"); > =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 endRange =3D new DynamicComposite("", new U= UID(Long.MAX_VALUE | > Long.MIN_VALUE, Long.MAX_VALUE | Long.MIN_VALUE)); > =A0=A0=A0 =A0=A0=A0 } > > =A0=A0=A0 =A0=A0=A0 mLog.debug("Setting range..."); > =A0=A0=A0 =A0=A0=A0 transQuery.setRange(startRange, endRange, false, 1000= 00); > > =A0=A0=A0 =A0=A0=A0 mLog.debug("Executing query..."); > =A0=A0=A0 =A0=A0=A0 QueryResult> qu= eryResults =3D > transQuery.execute(); > > } > > But I'm finding I'm just getting 0 results even if I use the values of > beginning of time ("00000000-0000-0000-0000-000000000000") and end of tim= e > ("ffffffff-ffff-ffff-ffff-ffffffffffff") > > I want to slice only across the Time component of the Composite. > > Is this possible? > > Anthony > > > On Mon, Jul 18, 2011 at 10:52 AM, Anthony Ikeda > wrote: >> >> Is this possible? I'm trying to create a Column Family with a >> CompositeType comparator, but I keep getting an error: >> >> create column family Transactions with comparator =3D >> CompositeType(UTF8Type, UUIDType) and keys_cached=3D10000 and >> rows_cached=3D1000; >> Syntax error at position 84: missing EOF at '(' >> >> Same issue if I try with DynamicCompositeType: >> >> create column family Transactions with comparator =3D >> DynamicCompositeType(s=3D>UTF8Type, u=3D>UUIDType) and keys_cached=3D100= 00 and >> rows_cached=3D1000; >> Syntax error at position 84: missing EOF at '(' >> >> I'm using Cassandra 0.8.1 >> >> Anthony >> > >