Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 20869 invoked from network); 3 Dec 2010 05:58:44 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 3 Dec 2010 05:58:44 -0000 Received: (qmail 9604 invoked by uid 500); 3 Dec 2010 05:58:42 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 9452 invoked by uid 500); 3 Dec 2010 05:58: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 9444 invoked by uid 99); 3 Dec 2010 05:58:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Dec 2010 05:58:41 +0000 X-ASF-Spam-Status: No, hits=1.5 required=10.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 (athena.apache.org: domain of narendra.sharma@gmail.com designates 209.85.161.44 as permitted sender) Received: from [209.85.161.44] (HELO mail-fx0-f44.google.com) (209.85.161.44) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Dec 2010 05:58:36 +0000 Received: by fxm9 with SMTP id 9so7636317fxm.31 for ; Thu, 02 Dec 2010 21:58:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=auu5/hhn0Ll6dpiks8a/wEz9RuUG+EgnkOldt6uSnNk=; b=WNBOF8oN7MUoAs/ChC9cgNNps0aE3GDSI5d0HOUG8x6UfXHlda97dPjEfBY7vA3WLn ECcBPSm1p+OTOd6X3rN7v449zbDz1244L+QwFNqKMz4Wy1v+r5Bc/MwFcYx/mWHZ3iXM EWgY8VJU64apoAoHoTfljCvFUEQPwTJpnTtwQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=s8GVK45r+S4yV6UqUbZNKjyiypI8USNvNhZgewB0shdKMmTeumGG3bEs8ZBRxjyP7w LKQtChYctVgl4KWA2g6sXLwMVQTGfb6vG8ZEwlSg/tAQAmRGGAS6GrarD1X60QUEQnI3 ccmRQFzh2NtBNEfKel1c1A5vj0i/tj3HVvky4= MIME-Version: 1.0 Received: by 10.223.70.131 with SMTP id d3mr1575748faj.73.1291355895062; Thu, 02 Dec 2010 21:58:15 -0800 (PST) Received: by 10.223.71.205 with HTTP; Thu, 2 Dec 2010 21:58:15 -0800 (PST) In-Reply-To: <2ac3cecf-838e-c27e-c844-a7820bdbe492@me.com> References: <2ac3cecf-838e-c27e-c844-a7820bdbe492@me.com> Date: Thu, 2 Dec 2010 21:58:15 -0800 Message-ID: Subject: Re: Fetch a SuperColumn based on value of column From: Narendra Sharma To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=20cf3054a64167607904967b3944 --20cf3054a64167607904967b3944 Content-Type: text/plain; charset=ISO-8859-1 Thanks Aaron! The first request requires you to know the SuperColumn name. In my case I don't know the SuperColumn name cause if I know then I can read the super column. I need to find the SuperColumn that has column with given value for a given column. The usecase is that application allows querying object by two attributes. I have made one of the attribute as Supercolumn name. I need to keep the second attribute as subcolumn in super column. Now I need to perform search by subcolumn. I think the only option is to maintain another CF with column name as the second attribute with value as the name of super column in current CF. Is there any better way to handle this? Thanks, Naren On Thu, Dec 2, 2010 at 5:48 PM, Aaron Morton wrote: > You can use column and super column names with the get_slice() function > without 0.7 secondary indexes. I'm assuming that the original query was to > test for the existence of a column by name. > > In the case below, to retrieve the full super column would require to > request... > > First to test the condition. get_slice with a ColumnParent that specifies > the CF and the Super Column and a slice predicate with the column_names[] > containing the name of the col you want. This query would only return the > one column. > > If you then wanted to get all columns in the super column you would make > another request. > > If making two requests is a pain or too slow, consider changing the data > model to better support the requests you need to make. > > AFAIK a lot of super columns will not impact performance any more than a > lot of column. There are however limitations to the number of columns in a > super column http://wiki.apache.org/cassandra/CassandraLimitations > > Hope that helps. > Aaron > > > On 03 Dec, 2010,at 01:10 PM, Nick Santini wrote: > > actually, the solution would be something like my last mail, but pointing > to the name of the super column and the row key > > > Nicolas Santini > Director of Cloud Computing > Auckland - New Zealand > (64) 09 914 9426 ext 2629 > (64) 021 201 3672 > > > > On Fri, Dec 3, 2010 at 1:08 PM, Nick Santini wrote: > >> Hi, >> as I got answered on my mail, secondary indexes for super column families >> is not supported yet, so you have to implement your own >> >> easy way: keep another column family where the row key is the value of >> your field and the columns are the row keys of your super column family >> >> (inverted index) >> >> >> Nicolas Santini >> Director of Cloud Computing >> Auckland - New Zealand >> (64) 09 914 9426 ext 2629 >> (64) 021 201 3672 >> >> >> >> >> On Fri, Dec 3, 2010 at 1:00 PM, Narendra Sharma < >> narendra.sharma@gmail.com> wrote: >> >>> Hi, >>> >>> My schema has a row that has thousands of Super Columns. The size of each >>> super column is around 500B (20 columns). I need to query 1 SuperColumn >>> based on value of one of its column. Something like >>> >>> SELECT SuperColumn FROM Row WHERE SuperColumn.column="value" >>> >>> Questions: >>> 1. Is this possible with current Cassandra APIs? If yes, could you please >>> show with a sample. >>> 2. How would such a query perform if the number of SuperColumns is high >>> (> 10K)? >>> >>> Cassandra version 0.7. >>> >>> Thanks, >>> Naren >>> >>> >> > --20cf3054a64167607904967b3944 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks Aaron!

The first request requires you to know the SuperColumn= name. In my case I don't know the SuperColumn name cause if I know the= n I can read the super column. I need to find the SuperColumn that has colu= mn with given value for a given column.
The usecase is that application allows querying object by two attributes. I= have made one of the attribute as Supercolumn name. I need to keep the sec= ond attribute as subcolumn in super column. Now I need to perform search by= subcolumn.
I think the only option is to maintain another CF with column name as the s= econd attribute with value as the name of super column in current CF. Is th= ere any better way to handle this?

Thanks,
Naren

On Thu, Dec 2, 2010 at 5:48 PM, Aaron Morton <aaron@thelastpickle.com> = wrote:
You can use column and super column names with the get_slice() fu= nction without 0.7 secondary indexes. I'm assuming that the original qu= ery was to test for the existence of a column by name.=A0

In the case below, to retrieve the full super column would require to = request...

First to test the condition. get_slice = with a ColumnParent that specifies the CF and the Super Column and a slice = predicate with the column_names[] containing the name of the col you want. = This query would only return the one column.=A0

If you then wanted to get all columns in the super colu= mn you would make another request.=A0

If making tw= o requests is a pain or too slow, consider changing the data model to bette= r support the requests you need to make.=A0

AFAIK a lot of super columns will not impact performanc= e any more than a lot of column. There are however limitations to the numbe= r of columns in a super column=A0http://wiki.apache.org/cassandra/= CassandraLimitations
=A0
Hope that helps.=A0
Aa= ron


On 03 Dec, 2010,at = 01:10 PM, Nick Santini <nick.santini@kaseya.com> wrote:

actually, the solution w= ould be something like my last mail, but pointing to the name of the super = column and the row key


Nicolas S= antini
Director of Cloud Computing
Auckland - New Zealand
(64) 09 914 9426 ext 2629
(= 64) 021 201 3672



On Fri, Dec 3, 2010 at 1:08 PM, Nick San= tini <nick.santini@kaseya.com> wrote:
Hi,
as I got answered on my mail, secondary indexes for super column fa= milies is not supported yet, so you have to implement your own
easy way: keep another column family where the row key is the = value of your field and the columns are the row keys of your super column f= amily

(inverted index)


Nicolas Santini
Director of Cloud Computing
A= uckland - New Zealand
(64) 09 914 9426 ext 2629
(64) 02= 1 201 3672




On Fri, Dec 3, 2010 at 1:00 PM, Narendra= Sharma <narendra.sharma@gmail.com> wrote:
Hi,

My schema has a row that has thousands of Super Columns. The siz= e of each super column is around 500B (20 columns). I need to query 1 Super= Column based on value of one of its column. Something like

SELECT Su= perColumn FROM Row WHERE SuperColumn.column=3D"value"

Questions:
1. Is this possible with current Cassandra APIs? If yes, = could you please show with a sample.
2. How would such a query perform i= f the number of SuperColumns is high (> 10K)?

Cassandra version 0= .7.

Thanks,
Naren




--20cf3054a64167607904967b3944--