Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 42681 invoked from network); 7 Oct 2010 15:14:10 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 7 Oct 2010 15:14:10 -0000 Received: (qmail 68388 invoked by uid 500); 7 Oct 2010 15:14:08 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 68357 invoked by uid 500); 7 Oct 2010 15:14:08 -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 68349 invoked by uid 99); 7 Oct 2010 15:14:08 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Oct 2010 15:14:08 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of decker.christian@gmail.com designates 209.85.216.172 as permitted sender) Received: from [209.85.216.172] (HELO mail-qy0-f172.google.com) (209.85.216.172) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Oct 2010 15:14:00 +0000 Received: by qyk1 with SMTP id 1so259373qyk.10 for ; Thu, 07 Oct 2010 08:13:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type; bh=ZWe1Ynz+uSPGFZmvBWug+HW8wC4PV/lLihS7NVllhrQ=; b=wjtptR7SYZm7dqCnpsyXYDvlkQzAa6kb3isEd/ARtEfgb9lYCZmGtMSafNH1mef8HC 256CM6k1HIObCGjIsiidjUcY7+WaF+TQBdUOdlFojM8fVVBg4tLTX1QvZPktZSityjdp Rm3sqQ26HZ+CDPRB0w08fIRS7lbmXJV0QYro0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=Ma1YqIeqKhWGx8rXuX4AQGieKt2dGXg66MKXQ9UOSfGzaucI+oZFP1rr0E8aVe3Ayj h0hw1Sbq+gkmCvIAm9w5HbCqFYGpqxJ9cGY2oa7mw+BLaEADjyX1vmlTKovC4bP1MUxL LC2+CgDYoUUcTcvaz360alBqkBuGSKIu17sJU= Received: by 10.224.53.154 with SMTP id m26mr411149qag.282.1286464419659; Thu, 07 Oct 2010 08:13:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.181.85 with HTTP; Thu, 7 Oct 2010 08:13:15 -0700 (PDT) In-Reply-To: References: From: Christian Decker Date: Thu, 7 Oct 2010 17:13:15 +0200 Message-ID: Subject: Re: Creating and using indices To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=00c09f99e303c00314049208566b X-Virus-Checked: Checked by ClamAV on apache.org --00c09f99e303c00314049208566b Content-Type: text/plain; charset=ISO-8859-1 So basically my indices should work? Is there a simple way to check that, so that we can exclude that? Are LTE working (or on the roadmap for the 0.7.0 release)? Or does the EQ operator have to math anything or can I just add an EQ to a not existing value to get LTE working too? Regards, Chris On Thu, Oct 7, 2010 at 4:57 PM, Petr Odut wrote: > What I've tested you must include at least one expression with EQ operator > > > On Thu, Oct 7, 2010 at 3:45 PM, Matthew Dennis wrote: > >> If I remember correctly the only operator supported for secondary indexes >> right now is EQ, not LTE (or the others). >> >> >> On Thu, Oct 7, 2010 at 6:13 AM, Christian Decker < >> decker.christian@gmail.com> wrote: >> >>> I'm currently trying to get started on secondary indices in Cassandra >>> 0.7.0svn, but without any luck so far. I have the following code that should >>> create an index on ColA: >>> >>> KsDef ksDef = client.describe_keyspace("MyKeyspace"); >>>> List cfs = ksDef.cf_defs; >>>> String columnFamily = "MyCF"; >>>> for(CfDef cf : ksDef.cf_defs){ >>>> if(cf.getName().equals(columnFamily)){ >>>> ColumnDef cd1 = new ColumnDef("ColA".getBytes(), >>>> "org.apache.cassandra.db.marshal.UTF8Type"); >>>> cd1.index_type = IndexType.KEYS; >>>> cf.column_metadata.add(cd1); >>>> // Write changes back to DB >>>> client.system_update_column_family(cf); >>>> } >>>> } >>>> >>> >>> which seems to work nicely since when turning up the logging level of >>> Cassandra it appears to apply some migrations, but then when I try to use a >>> pycassa client to read an indexed_slice I only get an >>> InvalidRequestException(why='No indexed columns present in index clause with >>> operator EQ'): >>> >>> cf = pycassa.ColumnFamily(client, "MyCF") >>>> ex = pycassa.index.create_index_expression('ColA', '50000000000000', >>>> pycassa.index.IndexOperator.LTE) >>>> clause = pycassa.index.create_index_clause([ex]) >>>> cf.get_indexed_slices(clause) >>>> >>> >>> Am I missing something? >>> >>> Regards, >>> Chris >>> >> >> >> >> -- >> Riptano >> Software and Support for Apache Cassandra >> http://www.riptano.com/ >> mdennis@riptano.com >> m: 512.587.0900 f: 866.583.2068 > > --00c09f99e303c00314049208566b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable So basically my indices should work? Is there a simple way to check that, s= o that we can exclude that?

Are LTE working (or on the roadmap for t= he 0.7.0 release)? Or does the EQ operator have to math anything or can I j= ust add an EQ to a not existing value to get LTE working too?

Regards,
Chris

On Thu, Oct 7, 2010= at 4:57 PM, Petr Odut <petr.odut@gmail.com> wrote:
What I've tested you must include at least one expression with EQ opera= tor


On = Thu, Oct 7, 2010 at 3:45 PM, Matthew Dennis <mdennis@riptano.com&g= t; wrote:
If I remember cor= rectly the only operator supported for secondary indexes right now is EQ, n= ot LTE (or the others).


On Thu, Oct 7, 2010 at 6= :13 AM, Christian Decker <decker.christian@gmail.com> wrote:
I'm currently= trying to get started on secondary indices in Cassandra 0.7.0svn, but with= out any luck so far. I have the following code that should create an index = on ColA:

=A0=A0=A0 =A0=A0=A0 KsDef ksDef =3D client.describe_keyspace("MyKeyspa= ce");
=A0=A0=A0 =A0=A0=A0 List<CfDef> cfs =3D ksDef.cf_defs;<= br>=A0=A0=A0 =A0=A0=A0 String columnFamily =3D "MyCF";
=A0=A0= =A0 =A0=A0=A0 for(CfDef cf : ksDef.cf_defs){
=A0=A0=A0 =A0=A0=A0 =A0=A0= =A0 if(cf.getName().equals(columnFamily)){
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 ColumnDef cd1 =3D new ColumnDef(&qu= ot;ColA".getBytes(), "org.apache.cassandra.db.marshal.UTF8Type&qu= ot;);
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 cd1.index_type =3D IndexTy= pe.KEYS;
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 cf.column_metadata.add(= cd1);
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 // Write changes back to DB
=A0= =A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 client.system_update_column_family(cf)= ;
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 }
=A0=A0=A0 =A0=A0=A0 }

which seems to work nicely since when turning up the logging le= vel of Cassandra it appears to apply some migrations, but then when I try t= o use a pycassa client to read an indexed_slice I only get an InvalidReques= tException(why=3D'No indexed columns present in index clause with opera= tor EQ'):

cf =3D pycass= a.ColumnFamily(client, "MyCF")
ex =3D pycassa.index.create_ind= ex_expression('ColA', '50000000000000', pycassa.index.Index= Operator.LTE)
clause =3D pycassa.index.create_index_clause([ex])
cf.get_indexed_slices= (clause)

=A0Am I missing something?

Regards= ,
Chris



--
Riptano
Software and Support for Apache Cassandra
http://www.riptano.com/=
mdennis@riptano.co= m
m: 512.587.0900 f: 866.583.2068

--00c09f99e303c00314049208566b--