Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 51429 invoked from network); 7 Oct 2010 11:20:08 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 7 Oct 2010 11:20:08 -0000 Received: (qmail 37966 invoked by uid 500); 7 Oct 2010 11:20:06 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 37334 invoked by uid 500); 7 Oct 2010 11:20:02 -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 37175 invoked by uid 99); 7 Oct 2010 11:20:01 -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 11:20:01 +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 11:19:53 +0000 Received: by qyk2 with SMTP id 2so989qyk.10 for ; Thu, 07 Oct 2010 04:19:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:from:date :message-id:subject:to:content-type; bh=5w0FBchsPrmmEWnOj3oY0+wonh30/fJwUhmUBsACWiI=; b=VJhVeMs12NplO7zahS/qsUQtkUKtSkiki5d/xhrWWDlOAve9U7lzU0z8mXTSe5dIGH G2dOM9qTqiFakH2veDq8dtiAMcCVfoFLNpB3sRzfNeKuzGhWsPOTq5Y9SFJbhh+RnWIG ajJVQPYa3ZKrfRZqoh+XsGJebh74zxXB2lIpU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=JudPTIc7yFBX00wX5KC/ynICoUxk/aEbIq/RnrQgA2Vxqv63nA8q3ApeTXb+NffgwN KdWWraYScKPh59ugzmvllrqgt7NgTQeAnr1gCQS685MkQyD754uFt4msoKPBoxucm7Gi 3RJDWn6U5T6NUjQ2yJSm1UTVIdtR9p1g4ykxE= Received: by 10.224.26.102 with SMTP id d38mr165144qac.236.1286450314791; Thu, 07 Oct 2010 04:18:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.181.85 with HTTP; Thu, 7 Oct 2010 04:13:18 -0700 (PDT) From: Christian Decker Date: Thu, 7 Oct 2010 13:13:18 +0200 Message-ID: Subject: Creating and using indices To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=00c09f9b0ab008cb950492050ea0 X-Virus-Checked: Checked by ClamAV on apache.org --00c09f9b0ab008cb950492050ea0 Content-Type: text/plain; charset=ISO-8859-1 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 --00c09f9b0ab008cb950492050ea0 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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:

=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
--00c09f9b0ab008cb950492050ea0--