From user-return-29355-apmail-cassandra-user-archive=cassandra.apache.org@cassandra.apache.org Sun Oct 7 20:44:02 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 ABA3D9A43 for ; Sun, 7 Oct 2012 20:44:02 +0000 (UTC) Received: (qmail 15748 invoked by uid 500); 7 Oct 2012 20:44:00 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 15711 invoked by uid 500); 7 Oct 2012 20:44:00 -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 15701 invoked by uid 99); 7 Oct 2012 20:43:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Oct 2012 20:43:59 +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 cyril.auburtin@gmail.com designates 209.85.215.44 as permitted sender) Received: from [209.85.215.44] (HELO mail-la0-f44.google.com) (209.85.215.44) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Oct 2012 20:43:54 +0000 Received: by mail-la0-f44.google.com with SMTP id b11so2017805lam.31 for ; Sun, 07 Oct 2012 13:43:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=Mmv+zAyQZ1v3sBUT+i9F5ho0LBzwVErPmj7TlDE7lcc=; b=oeNGFTsxkTJWDJDlYNMDQzuZLsDEnLItb/xXH07OGOXA+Mfp+T8UrB0F76ShJ62Duk VtiJVdmNJMcGKeVrstpoZt9T58Ij9Inr/HDGhDMDhNPPJag6R3ivL8GN2jw9TFFI9hV9 yYrQk2/sPgm2v1MtuQiSUKGaxN4HsAwlrfWoHmj2cSJBYH8LEYfJiFxITqmNNpvyav/6 /LryG9iHFS3sP1NC5mfGddE1JzC/LN9ueb4pAqYSZFnE3wB8fL7/Apds92tXnhZh+y1u MS1ECpQO+zrj0HijNVIu5iHBCPdXPrUtB+LRHhrp157QfBi+KtzdTdda7nfqG2Smei8R hltg== Received: by 10.152.124.180 with SMTP id mj20mr11708597lab.43.1349642613032; Sun, 07 Oct 2012 13:43:33 -0700 (PDT) MIME-Version: 1.0 Received: by 10.114.3.68 with HTTP; Sun, 7 Oct 2012 13:43:12 -0700 (PDT) In-Reply-To: <62429F36-D470-43DA-A9EB-90CB21E160A9@thelastpickle.com> References: <62429F36-D470-43DA-A9EB-90CB21E160A9@thelastpickle.com> From: Cyril Auburtin Date: Sun, 7 Oct 2012 22:43:12 +0200 Message-ID: Subject: Re: cql3 and cli composites columns To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=f46d0434bfde86080a04cb7e2830 X-Virus-Checked: Checked by ClamAV on apache.org --f46d0434bfde86080a04cb7e2830 Content-Type: text/plain; charset=ISO-8859-1 Thanks Aaron, I don't understand what is the cli equivalent of: CREATE TABLE timeline ( user_id varchar, tweet_id bigint, author varchar, body varchar, PRIMARY KEY (user_id, tweet_id) ); 2012/10/3 aaron morton > > If it's just a printing issue it's really minor though > > I would guess because timeline CF has defined columns and line CF does > not. > > All cqlsh knows is that every column name has two parts, it does not know > what the column names will be. The difference between a static and dynamic > CF. > > Hope that helps. > > ----------------- > Aaron Morton > Freelance Developer > @aaronmorton > http://www.thelastpickle.com > > On 2/10/2012, at 10:37 PM, Cyril Auburtin > wrote: > > > I wanted to know why the highlighted sections below are printed > differently, the 2 column families are the same > > > > Key Validation Class: org.apache.cassandra.db.marshal.UTF8Type > > Default column value validator: org.apache.cassandra.db.marshal.UTF8Type > > Columns sorted by: > org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.LongType,org.apache.cassandra.db.marshal.UTF8Type) > > > > , except one is created from cql3: > > > > If it's just a printing issue it's really minor though > > > > on cql3: > > CREATE TABLE timeline ( > > ... user_id varchar, > > ... tweet_id bigint, > > ... author varchar, > > ... body varchar, > > ... PRIMARY KEY (user_id, tweet_id) > > ... ); > > INSERT INTO timeline (user_id, tweet_id, author, body) VALUES ('gmason', > 1765, 'phenry', 'Give me liberty or give me death'); > > > > > > on CLI: > > > > create column family line with comparator = 'CompositeType(LongType, > UTF8Type)' AND key_validation_class=UTF8Type AND default_validation_class = > UTF8Type; > > set line['dude']['1545:ok'] = '1'; > > set line['dude']['1545:ok1'] = '11111'; > > > > list timeline; > > RowKey: gmason > > => (column=1765:author, value=phenry, timestamp=1349161331154000) > > => (column=1765:body, value=Give me liberty or give me death, > timestamp=1349161331154001) > > > > list line; > > RowKey: dude > > => (column=1545:ok, value=1, timestamp=1349162658714000) > > => (column=1545:ok1, value=11111, timestamp=1349162638658000) > > > > on cql3: > > > > select * from timeline; > > user_id | tweet_id | author | body > > ---------+----------+--------+---------------------------------- > > gmason | 1765 | phenry | Give me liberty or give me death > > > > > > select * from line; > > key | column1 | column2 | value > > ------+---------+---------+------- > > dude | 1545 | ok | 1 > > dude | 1545 | ok1 | 11111 > > > > > > > > ps: I have tried > > > > update column family line with comparator = 'CompositeType(LongType, > UTF8Type)' AND key_validation_class=UTF8Type AND column_metadata = [ > > {column_name: tweet_id, validation_class: LongType} > > {column_name: author, validation_class: UTF8Type} > > {column_name: body, validation_class: UTF8Type} > > ]; > > for the CF line but it gives: > > java.lang.RuntimeException: > org.apache.cassandra.db.marshal.MarshalException: unable to make long from > 'tweet_id' > > > > --f46d0434bfde86080a04cb7e2830 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks Aaron,
I don't understand what is the cli equivalent of:

CREATE TABLE timeline (
=A0 =A0 =A0 =A0 =A0 user_i= d varchar,
=A0 =A0 =A0 =A0 =A0 tweet_id bigint,
=A0 =A0 =A0 =A0 =A0 a= uthor varchar,
=A0 =A0 =A0 =A0 =A0 body varchar,
=A0 =A0 =A0 =A0 =A0 PRIMARY KEY (user_id, tweet_id)
=A0 =A0 =A0 = =A0 );


2012/10/3 aaro= n morton <aaron@thelastpickle.com>
> If it's just a pr= inting issue it's really minor though

I would guess because =A0timeline CF has defined columns and line CF = does not.

All cqlsh knows is that every column name has two parts, it does not know w= hat the column names will be. The difference between a static and dynamic C= F.

Hope that helps.

-----------------
Aaron Morton
Freelance Developer
@aaronmorton
http://www.thela= stpickle.com

On 2/10/2012, at 10:37 PM, Cyril Auburtin <cyril.auburtin@gmail.com> wrote:

> I wanted to know why the highlighted sections below are printed differ= ently, the 2 column families are the same
>
> Key Validation Class: org.apache.cassandra.db.marshal.UTF8Type
> Default column value validator: org.apache.cassandra.db.marshal.UTF8Ty= pe
> Columns sorted by: org.apache.cassandra.db.marshal.CompositeType(org.a= pache.cassandra.db.marshal.LongType,org.apache.cassandra.db.marshal.UTF8Typ= e)
>
> , except one is created from cql3:
>
> If it's just a printing issue it's really minor though
>
> on cql3:
> CREATE TABLE timeline (
> =A0 =A0 =A0 =A0 ... =A0 user_id varchar,
> =A0 =A0 =A0 =A0 ... =A0 tweet_id bigint,
> =A0 =A0 =A0 =A0 ... =A0 author varchar,
> =A0 =A0 =A0 =A0 ... =A0 body varchar,
> =A0 =A0 =A0 =A0 ... =A0 PRIMARY KEY (user_id, tweet_id)
> =A0 =A0 =A0 =A0 ... );
> INSERT INTO timeline (user_id, tweet_id, author, body) VALUES ('gm= ason', 1765, 'phenry', 'Give me liberty or give me death= 9;);
>
>
> on CLI:
>
> create column family line with comparator =3D 'CompositeType(LongT= ype, UTF8Type)' AND key_validation_class=3DUTF8Type AND default_validat= ion_class =3D UTF8Type;
> set line['dude']['1545:ok'] =3D '1';
> set line['dude']['1545:ok1'] =3D '11111';
>
> list timeline;
> RowKey: gmason
> =3D> (column=3D1765:author, value=3Dphenry, timestamp=3D13491613311= 54000)
> =3D> (column=3D1765:body, value=3DGive me liberty or give me death,= timestamp=3D1349161331154001)
>
> list line;
> RowKey: dude
> =3D> (column=3D1545:ok, value=3D1, timestamp=3D1349162658714000) > =3D> (column=3D1545:ok1, value=3D11111, timestamp=3D134916263865800= 0)
>
> on cql3:
>
> select * from timeline;
> =A0user_id | tweet_id | author | body
> ---------+----------+--------+----------------------------------
> =A0 gmason | =A0 =A0 1765 | phenry | Give me liberty or give me death<= br> >
>
> select * from line;
> =A0key =A0| column1 | column2 | value
> ------+---------+---------+-------
> =A0dude | =A0 =A01545 | =A0 =A0 =A0ok | =A0 =A0 1
> =A0dude | =A0 =A01545 | =A0 =A0 ok1 | 11111
>
>
>
> ps: I have tried
>
> update column family line with comparator =3D 'CompositeType(LongT= ype, UTF8Type)' AND key_validation_class=3DUTF8Type AND column_metadata= =3D [
> {column_name: tweet_id, validation_class: LongType}
> {column_name: author, validation_class: UTF8Type}
> {column_name: body, validation_class: UTF8Type}
> ];
> for the CF line but it gives:
> java.lang.RuntimeException: org.apache.cassandra.db.marshal.MarshalExc= eption: unable to make long from 'tweet_id'
>


--f46d0434bfde86080a04cb7e2830--