incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aaron morton <aa...@thelastpickle.com>
Subject Re: cql3 and cli composites columns
Date Wed, 03 Oct 2012 07:25:53 GMT
> 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 <cyril.auburtin@gmail.com> 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'
> 


Mime
View raw message