From user-return-25024-apmail-cassandra-user-archive=cassandra.apache.org@cassandra.apache.org Mon Mar 26 17:04:39 2012
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 B4613907E
for ; Mon, 26 Mar 2012 17:04:39 +0000 (UTC)
Received: (qmail 20043 invoked by uid 500); 26 Mar 2012 17:04:37 -0000
Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org
Received: (qmail 20008 invoked by uid 500); 26 Mar 2012 17:04:37 -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 19999 invoked by uid 99); 26 Mar 2012 17:04:37 -0000
Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136)
by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Mar 2012 17:04:37 +0000
X-ASF-Spam-Status: No, hits=1.5 required=5.0
tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS
X-Spam-Check-By: apache.org
Received-SPF: pass (athena.apache.org: domain of benjamin.j.mccann@gmail.com designates 74.125.82.172 as permitted sender)
Received: from [74.125.82.172] (HELO mail-we0-f172.google.com) (74.125.82.172)
by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Mar 2012 17:04:33 +0000
Received: by werb10 with SMTP id b10so5216812wer.31
for ; Mon, 26 Mar 2012 10:04:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:sender:in-reply-to:references:date
:x-google-sender-auth:message-id:subject:from:to:content-type;
bh=AHvxaEIP4kYg/x5N526Pwfh531ZDgR+Jvcw3+gyzhJM=;
b=eMHY4TrmTtHwPiAfXr8Igjh7eViTmXvzgiF/jmlfsdiiHn1D+KezHWoFejFHptyVM8
f90gTDTxOkKCV13iCtqSHsW25OUK3zG3OwZgq5SmRVgXypXkjCo+l5VIiyndX1k5cfuK
plDcnLP64xHupJdZkeNLZXsBRJC1zl7rUPPB3uJSwky98Zw2Fb4cX8MebPZDYh6OiR7i
+WSOBxZLkbp94zuDnYfE1nGJuJtzvYOItHU49yFunVFd8X0hfagtoDMDNlaCvzXAU49u
mSQ7Gyn5La04HwqLe6L7hzDWWHmg8BRNGNlfbBWbpl9WgRvknL4vRLp4g4cHSjtVSJbD
UY/A==
MIME-Version: 1.0
Received: by 10.180.24.66 with SMTP id s2mr20329851wif.7.1332781451539; Mon,
26 Mar 2012 10:04:11 -0700 (PDT)
Sender: benjamin.j.mccann@gmail.com
Received: by 10.216.230.95 with HTTP; Mon, 26 Mar 2012 10:04:11 -0700 (PDT)
In-Reply-To:
References:
Date: Mon, 26 Mar 2012 10:04:11 -0700
X-Google-Sender-Auth: TOC9ivpyCoXnDQGfBRjIac0Swa0
Message-ID:
Subject: Re: How to store a list of values?
From: Ben McCann
To: user@cassandra.apache.org
Content-Type: multipart/alternative; boundary=f46d043be1d0fb76f304bc285cbb
X-Virus-Checked: Checked by ClamAV on apache.org
--f46d043be1d0fb76f304bc285cbb
Content-Type: text/plain; charset=ISO-8859-1
True. But I don't need the skills to be searchable, so I'd rather embed
them in the user than add another top-level CF. I was thinking of doing
something along the lines of adding a skills super column to the User table:
skills: {
'java': null,
'c++': null,
'cobol': null
}
However, I'm still not sure yet how to accomplish this with Astyanax. I've
only figured out how to make composite columns with predefined column names
with it and not dynamic column names like this.
On Mon, Mar 26, 2012 at 9:08 AM, R. Verlangen wrote:
> In this case you only neem the columns for values. You don't need the
> column-values to hold multiple columns (the super-column principle). So a
> normal CF would work.
>
>
> 2012/3/26 Ben McCann
>
>> Thanks for the reply Samal. I did not realize that you could store a
>> column with null value. Do you know if this solution would work with
>> composite columns? It seems super columns are being phased out in favor of
>> composites, but I do not understand composites very well yet. I'm trying
>> to figure out if there's any way to accomplish what you've suggested using
>> Astyanax .
>>
>> Thanks for the help,
>> Ben
>>
>>
>> On Mon, Mar 26, 2012 at 8:46 AM, samal wrote:
>>
>>> plus it is fully compatible with CQL.
>>> SELECT * FROM UserSkill WHERE KEY='ben';
>>>
>>>
>>> On Mon, Mar 26, 2012 at 9:13 PM, samal wrote:
>>>
>>>> I would take simple approach. create one other CF "UserSkill" with row
>>>> key same as profile_cf key,
>>>> In user_skill cf will add skill as column name and value null. Columns
>>>> can be added or removed.
>>>>
>>>> UserProfile={
>>>> '*ben*'={
>>>> blah :blah
>>>> blah :blah
>>>> blah :blah
>>>> }
>>>> }
>>>>
>>>> UserSkill={
>>>> '*ben*'={
>>>> 'java':''
>>>> 'cassandra':''
>>>> .
>>>> .
>>>> .
>>>> 'linux':''
>>>> 'skill':'infinity'
>>>>
>>>> }
>>>>
>>>> }
>>>>
>>>>
>>>> On Mon, Mar 26, 2012 at 12:34 PM, Ben McCann wrote:
>>>>
>>>>> I have a profile column family and want to store a list of skills in
>>>>> each profile. In BigTable I could store a Protocol Bufferwith a repeated field, but I'm not sure how this is typically accomplished
>>>>> in Cassandra. One option would be to store a serialized Thriftor protobuf, but I'd prefer not to do this as I believe Cassandra doesn't
>>>>> have knowledge of these formats, and so the data in the datastore would not
>>>>> not human readable in CQL queries from the command line. The other
>>>>> solution I thought of would be to use a super column and put a random UUID
>>>>> as the key for each skill:
>>>>>
>>>>> skills: {
>>>>> '4b27c2b3ac48e8df': 'java',
>>>>> '84bf94ea7bc92018': 'c++',
>>>>> '9103b9a93ce9d18': 'cobol'
>>>>> }
>>>>>
>>>>> Is this a good way of handling lists in Cassandra? I imagine there's
>>>>> some idiom I'm not aware of. I'm using the Astyanaxclient library, which only supports composite columns instead of super
>>>>> columns, and so the solution I proposed above would seem quite awkward in
>>>>> that case. Though I'm still having some trouble understanding composite
>>>>> columns as they seem not to be completely documented yet. Would this
>>>>> solution work with composite columns?
>>>>>
>>>>> Thanks,
>>>>> Ben
>>>>>
>>>>>
>>>>
>>>
>>
>
>
> --
> With kind regards,
>
> Robin Verlangen
> www.robinverlangen.nl
>
>
--f46d043be1d0fb76f304bc285cbb
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
True. =A0But I don't need the skills to be searchable, so I'd rathe=
r embed them in the user than add another top-level CF. =A0I was thinking o=
f doing something along the lines of adding a skills super column to the Us=
er table:

skills: {

=A0 'java': nul=
l,

=A0 'c++': null,

=A0 'cobol&=
#39;: null

}

However, =
I'm still not sure yet how to accomplish this with Astyanax. =A0I'v=
e only figured out how to make composite columns with predefined column nam=
es with it and not dynamic column names like this.

Thanks for the reply Samal. =A0I did no=
t realize that you could store a column with null value. =A0Do you know if =
this solution would work with composite columns? =A0It seems super columns =
are being phased out in favor of composites, but I do not understand compos=
ites very well yet. =A0I'm trying to figure out if there's any way =
to accomplish what you've suggested using Astyanax.

I would take simple approach. create one oth=
er CF "UserSkill"=A0 with row key same as profile_cf key, In =
user_skill cf will add skill as column name and value null. Columns can be =
added or removed.

I have a profile column family and want to s=
tore a list of skills in each profile. =A0In BigTable I could store a Protocol Buffer with a repeated field, but I'm not sur=
e how this is typically accomplished in Cassandra. =A0One option would be t=
o store a serialized Thrift or protobuf, but I'd prefer not to do this as I believe Ca=
ssandra doesn't have knowledge of these formats, and so the data in the=
datastore would not not human readable in CQL queries from the command lin=
e. =A0The other solution I thought of would be to use a super column and pu=
t a random UUID as the key for each skill:

skills: {

=A0 '4b27c2b3ac48e8df': 'jav=
a',

=A0 '84bf94ea7bc92018': 'c++',

=
=A0 '9103b9a93ce9d18': 'cobol'

}

=
div>

Is this a good way of handling lists in Cassandra? =A0I imagine there&=
#39;s some idiom I'm not aware of. =A0I'm using the Astyanax client=
library, which only supports composite columns instead of super columns, a=
nd so the solution I proposed above would seem quite awkward in that case. =
=A0Though I'm still having some trouble understanding composite columns=
as they seem not to be completely documented yet. =A0Would this solution w=
ork with composite columns?