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 4C6A5DEE2 for ; Tue, 13 Nov 2012 13:42:39 +0000 (UTC) Received: (qmail 87422 invoked by uid 500); 13 Nov 2012 13:42:36 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 87398 invoked by uid 500); 13 Nov 2012 13:42:36 -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 87381 invoked by uid 99); 13 Nov 2012 13:42:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Nov 2012 13:42:35 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of rkevinburton@charter.net designates 216.33.127.81 as permitted sender) Received: from [216.33.127.81] (HELO mta21.charter.net) (216.33.127.81) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Nov 2012 13:42:28 +0000 Received: from imp11 ([10.20.200.11]) by mta21.charter.net (InterMail vM.8.01.05.09 201-2260-151-124-20120717) with ESMTP id <20121113134207.BPZU10448.mta21.charter.net@imp11> for ; Tue, 13 Nov 2012 08:42:07 -0500 Received: from KevinPC ([24.159.241.210]) by imp11 with smtp.charter.net id P1i61k00R4Z4VX4051i6ua; Tue, 13 Nov 2012 08:42:07 -0500 X-Authority-Analysis: v=1.1 cv=Agrl9JAs5+GZar64di+3zu8XOh97iO5Qaqn/xe6For4= c=1 sm=1 a=oRK_6wiwGcwA:10 a=yUnIBFQkZM0A:10 a=rvDZ1Ou6zk5jcJFOa7NSqA==:17 a=a5LNsaEAAAAA:8 a=mV9VRH-2AAAA:8 a=hOpmn2quAAAA:8 a=5GG0SCeFAAAA:8 a=n9WvmQqIf73p3KS_Z4IA:9 a=CjuIK1q_8ugA:10 a=JHKnsczD40cA:10 a=hUswqBWy9Q8A:10 a=GED_LIiEBe0A:10 a=yMhMjlubAAAA:8 a=SSmOFEACAAAA:8 a=h7vc04bkiBvyjW-XaTMA:9 a=gKO2Hq4RSVkA:10 a=UiCQ7L4-1S4A:10 a=hTZeC7Yk6K0A:10 a=frz4AuCg-hUA:10 a=NWVoK91CQyQA:10 a=16m8dWUz3YStBGMI:21 a=rvDZ1Ou6zk5jcJFOa7NSqA==:117 From: "Kevin Burton" To: References: <00c901cdc0a8$475fecc0$d61fc640$@charter.net> <902DFBD4-E417-42DC-B04B-CDB10DA6A7E6@thelastpickle.com> <730FE661-F3DC-4070-AF62-CFA974A4D46A@charter.net> In-Reply-To: Subject: RE: CF metadata syntax for an array Date: Tue, 13 Nov 2012 07:42:04 -0600 Message-ID: <01af01cdc1a4$aafc6f40$00f54dc0$@charter.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_01B0_01CDC172.60692B30" X-Mailer: Microsoft Outlook 14.0 Content-language: en-us Thread-Index: AQGvhuXIQFPGNtPD2kCFJ9YZSiQcewIa1aS7AqXyIVYCwqJqVJfoHCDQ X-Virus-Checked: Checked by ClamAV on apache.org This is a multipart message in MIME format. ------=_NextPart_000_01B0_01CDC172.60692B30 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sorry to be so slow but I am just learning CQL. Would this syntax be the same for CREATE COLUMNFAMILY (as an aside what is a 'TABLE' in Cassandra)? In other words is this valid: CREATE COLUMNFAMILY Description ( PRIMARY_KEY (vector_name, index), Age text, Gender text, vector_name text, index bigint, ... Or CREATE COLUMNFAMILY Description ( PRIMARY_KEY (listr_name, sort_key), Age text, Gender text, sort_key bigint, list_name text .. Does the array have to be a KEY? Finally, what would be the syntax for inserting data into the CF? Thanks again. From: aaron morton [mailto:aaron@thelastpickle.com] Sent: Tuesday, November 13, 2012 4:09 AM To: user@cassandra.apache.org Subject: Re: CF metadata syntax for an array While this solves the problem for an array of 'primitive' types. What if I want an array or collection of an arbitrary type like list, where foo is a user defined type? Do you mean a custom Cassandra data type that sub classes AbstractType? I dont think CQL can support those, I may be wrong though. If you mean a basic client side data type you could serialise it and store as a string or byte buffer in a CQL collection. What are the options to solve this type of array? ... arbitrary type like list, Do you mean an array such as int[] or do you mean the equivalent of a java List with functions like remove that actually delete items and from the list? If it's the former a CQL table such as below would work CREATE TABLE vectors ( vector_name text, index bigint, object_property_1 text, object_property_2 text, PRIMARY_KEY (vector_name, index) ); The problem is, if you delete a element at (vector, index) the remaining indexes will be off. If it's the later, a List, then it depends a little on what features you want to support. If you want a sorted list of objects the table is roughly the same CREATE TABLE List ( list_name text, sort_key bigint, object_property_1 text, object_property_2 text, PRIMARY_KEY (list_name, sort_key) ); Hope that helps. ----------------- Aaron Morton Freelance Developer @aaronmorton http://www.thelastpickle.com ----------------- Aaron Morton Freelance Developer @aaronmorton http://www.thelastpickle.com On 13/11/2012, at 9:46 AM, Kevin Burton wrote: While this solves the problem for an array of 'primitive' types. What if I want an array or collection of an arbitrary type like list, where foo is a user defined type? I am guessing that this cannot be done with 'collections'. What are the options to solve this type of array? On Nov 12, 2012, at 2:28 PM, aaron morton wrote: This may help http://www.datastax.com/dev/blog/cql3_collections I have gotten as far as feeling a need to understand a 'super-column' You can happily ignore them. Cheers ----------------- Aaron Morton Freelance Developer @aaronmorton http://www.thelastpickle.com On 12/11/2012, at 8:35 PM, Kevin Burton wrote: I am sorry if this is an FAQ. But I was wondering what the syntax for describing an array? I have gotten as far as feeling a need to understand a 'super-column' but I fail after that. Once I have the metadata in place to describe an array how do I insert data into the array? Get data from the array? Thank you. ------=_NextPart_000_01B0_01CDC172.60692B30 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Sorry to be so slow but I am just learning CQL. Would this syntax be = the same for CREATE COLUMNFAMILY (as an aside what is a = ‘TABLE’ in Cassandra)? In other words is this = valid:

 

           &nbs= p;            = CREATE COLUMNFAMILY Description (

           &nbs= p;            = ;            =             &= nbsp;      PRIMARY_KEY (vector_name, = index),

           &nbs= p;            = ;            =             &= nbsp;      Age text,

           &nbs= p;            = ;            =             &= nbsp;      Gender text,

           &nbs= p;    =             &= nbsp;           &n= bsp;           &nb= sp; vector_name = text,
          &nbs= p;     =             &= nbsp;           &n= bsp;           &nb= sp; index bigint,
…..

 

Or

           &nbs= p;            = CREATE COLUMNFAMILY Description (

           &nbs= p;            = ;            =             &= nbsp;      PRIMARY_KEY (listr_name, = sort_key),

           &nbs= p;            = ;            =             &= nbsp;      Age text,

           &nbs= p;            = ;            =             &= nbsp;      Gender text,

           &nbs= p;    =             &= nbsp;           &n= bsp;  =             s= ort_key = bigint,
          &n= bsp;     =             &= nbsp;           &n= bsp;  =            list_na= me text

….

Does the  array have to be a KEY? Finally, what would be the = syntax for inserting data into the CF?

 

Thanks again.

 

From:= = aaron morton [mailto:aaron@thelastpickle.com]
Sent: Tuesday, = November 13, 2012 4:09 AM
To: = user@cassandra.apache.org
Subject: Re: CF metadata syntax for = an array

 

While this solves the problem for an array of = 'primitive' types. What if I want an array or collection of an arbitrary = type like list<foo>, where foo is a user defined = type?

Do you mean = a custom Cassandra data type that sub classes AbstractType? I dont think = CQL can support those, I may be wrong = though. 

 

If you mean a basic client side data type you could = serialise it and store as a string or byte buffer in a CQL = collection. 

 

What = are the options to solve this type of = array? 

...

arbitrary type like = list<foo>, 

Do you = mean an array such as int[] or do you mean the equivalent of a java = List<T> with functions like remove that actually delete items and = from the list?

 

If it's the former a CQL table such as below would = work

 

CREATE TABLE vectors (
        &n= bsp;   vector_name text,
        &n= bsp;   index bigint,
        &n= bsp;   object_property_1 text,
        &n= bsp;   object_property_2 = text,

        &n= bsp;   PRIMARY_KEY (vector_name, = index)

);

 

The problem is, if you delete a element at (vector, = index) the remaining indexes will be off.

 

If it's the later, a List<T>, then it depends a = little on what features you want to support. If you want a sorted list = of objects the table is roughly the same

 

CREATE TABLE List (
        &n= bsp;   list_name text,
        &n= bsp;   sort_key bigint,
        &n= bsp;   object_property_1 text,
        &n= bsp;   object_property_2 = text,

        &n= bsp;   PRIMARY_KEY (list_name, = sort_key)

);

 

Hope that helps. 

 

-----------------

Aaron Morton

Freelance Developer

@aaronmorton

 

-----------------

Aaron Morton

Freelance Developer

@aaronmorton

 

On = 13/11/2012, at 9:46 AM, Kevin Burton <rkevinburton@charter.net>= wrote:



While this solves the problem for an = array of 'primitive' types. What if I want an array or collection of an = arbitrary type like list<foo>, where foo is a user defined type? I = am guessing that this cannot be done with 'collections'. What are the = options to solve this type of array?

On Nov 12, 2012, at 2:28 PM, = aaron morton <aaron@thelastpickle.com> = wrote:

 

 I = have gotten as far as feeling a need to understand a = ‘super-column’ 

You can happily ignore = them.

 

 

Cheers

 

---------= --------

Aaron = Morton

Freelance= Developer

@aaronmor= ton

 

On = 12/11/2012, at 8:35 PM, Kevin Burton <rkevinburton@charter.net>= wrote:



I am sorry = if this is an FAQ. But I was wondering what the syntax for describing an = array? I have gotten as far as feeling a need to understand a = ‘super-column’ but I fail after that. Once I have the = metadata in place to describe an array how do I  insert data into = the array? Get data from the array? Thank = you.

 =

 

 

------=_NextPart_000_01B0_01CDC172.60692B30--