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 5B9CD68FC for ; Thu, 4 Aug 2011 09:11:26 +0000 (UTC) Received: (qmail 20786 invoked by uid 500); 4 Aug 2011 09:11:24 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 19892 invoked by uid 500); 4 Aug 2011 09:11:13 -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 19742 invoked by uid 99); 4 Aug 2011 09:11:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Aug 2011 09:11:00 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of yulinyen@gmail.com designates 209.85.215.170 as permitted sender) Received: from [209.85.215.170] (HELO mail-ey0-f170.google.com) (209.85.215.170) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Aug 2011 09:10:51 +0000 Received: by eyd10 with SMTP id 10so482587eyd.1 for ; Thu, 04 Aug 2011 02:10:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=m4z2tjXn2i6qGfTYGdHsX3+uUtsvAPyFaemygHk8S/I=; b=OqrWwULr6g7v4IvTc9NbeyZcTmie54VpDTrQ3J7tlTHqE/TdyzIM3/VtQwiILEyYKU Luj8bodSNBX4n1FNWt4DqDa6yYB8NcIV45o5B7IBCz8NDdOpz48/bPGDpOtvUITFoV7d Sd78UwOugCle1omYuulZus2mL4lN0iVXS9kWI= MIME-Version: 1.0 Received: by 10.14.9.228 with SMTP id 76mr130047eet.206.1312449031438; Thu, 04 Aug 2011 02:10:31 -0700 (PDT) Received: by 10.14.45.8 with HTTP; Thu, 4 Aug 2011 02:10:31 -0700 (PDT) In-Reply-To: References: Date: Thu, 4 Aug 2011 17:10:31 +0800 Message-ID: Subject: Re: HOW TO select a column or all columns that start with X From: Boris Yen To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=0016364c6ecf4e037104a9aa5af4 X-Virus-Checked: Checked by ClamAV on apache.org --0016364c6ecf4e037104a9aa5af4 Content-Type: text/plain; charset=ISO-8859-1 Assume you have a column family named "testCF" with comparator * CompositeType*(AsciiType, IntegerType(reversed=true), IntegerType); and a few columns have been inserted into record key "a". ____________________________________ Composite start = new Composite() ; Composite end = new Composite() ; start.addComponent("abc", StringSerializer.get()) ; end.addComponent("abc", StringSerializer.get(), "UTF8Type", AbstractComposite.ComponentEquality.GREATER_THAN_EQUAL) ; SliceQuery query = HFactory.createSliceQuery(keyspace, StringSerializer.get(), ByteBufferSerializer.get(), ByteBufferSerializer.get()); query.setKey("a"); query.setColumnFamily("testCF"); query.setRange(start.serialize(), end.serialize(), false, 100); List> columns = query.execute().get().getColumns(); On Thu, Aug 4, 2011 at 3:19 PM, CASSANDRA learner < cassandralearner@gmail.com> wrote: > Can you please gimme an example on this using hector client > > > On Thu, Aug 4, 2011 at 7:18 AM, Boris Yen wrote: > >> It seems to me that your column name consists of two components. If you >> have the luxury to upgrade your cassandra to 0.8.1+, I think you can think >> about using the composite type/column. Conceptually, it might suit your use >> case better. >> >> >> On Wed, Aug 3, 2011 at 5:28 AM, Eldad Yamin wrote: >> >>> Hello, >>> I wonder if I can select a column or all columns that start with X. >>> E.g I have columns ABC_1, ABC_2, ZZZ_1 and I want to select all columns >>> that start with ABC_ - is that possible? >>> >>> >>> >>> Thanks! >>> >> >> > --0016364c6ecf4e037104a9aa5af4 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Assume you have a column family named "testCF" with comparator=A0= <= span>CompositeType(AsciiType, Integer= Type(reversed=3Dtrue),=A0IntegerType); and a few colum= ns have been inserted into record key "a".

____________________________________
Composite s= tart =3D new Composite() ;
Composite end =3D new Composi= te() ;
start.addComponent("abc&quo= t;, StringSerializer.get()) ;
end.addComponent("abc&qu= ot;, StringSerializer.get(), "UTF8Type", AbstractComposite.Compon= entEquality.GREATER_THAN_EQUAL) ;

SliceQuery<String, ByteBuffer, ByteBuffer> query =3D HFactory.cr= eateSliceQuery(keyspace, StringSerializer.get(), ByteBufferSerializer.get()= , ByteBufferSerializer.get());
query.setKey("a");
query.setColumnFamily("tes= tCF");
query.setRange(start.serialize(), end.serialize(), fa= lse, 100);

List<HColumn<ByteBuffer, ByteBuffer>> columns =3D = query.execute().get().getColumns();


On Thu, Aug 4, 20= 11 at 3:19 PM, CASSANDRA learner <cassandralearner@gmail.com> wrote:<= br>
Can you please gimme an example on this usi= ng hector client


On Thu, Aug 4, 2011 at 7:18 AM, Boris Yen <yulinyen@gmail.com> wrote:
It seems to me that your column name consist= s of two components. If you have the luxury to upgrade your cassandra to 0.= 8.1+, I think you can think about using the composite type/column. Conceptu= ally, it might suit your use case better.


On Wed, Aug 3, 2011 at 5:28 AM, Eldad Yamin = <eldad87@gmail.com> wrote:
Hello,
I wonder if I can select a column or all column= s that start with X.
E.g I have columns ABC_1, ABC_2, ZZZ_1 and I= want to select all columns that start with ABC_ - is that possible?



Thanks!



--0016364c6ecf4e037104a9aa5af4--