cqlsh - Cassandra Composite Column Family -


i have simple requirement in sql world want create

create table event_tracking (   key text,   trackingid timeuuid,   entityid bigint,   entitytype text   userid bigint   primary key (key, trackingid) ) 

i need cli create command not able it. need create column family through cli pig cannot read column family created through cqlsh (duh)

here tried , didnt worked

 create column family event_tracking ...  comparator='compositetype(timeuuidtype)' ...  , key_validation_class=utf8type ...  , default_validation_class = utf8type; 

1) dont know why add value column when see in cqlsh

create table event_tracking (   key text,   trackingid timeuuid,   value text,   primary key (key, trackingid) ) compact storage ,   bloom_filter_fp_chance=0.010000 ,   caching='keys_only' ,   comment='' ,   dclocal_read_repair_chance=0.000000 ,   gc_grace_seconds=864000 ,   read_repair_chance=0.100000 ,   replicate_on_write='true' ,   populate_io_cache_on_flush='false' ,   compaction={'class': 'sizetieredcompactionstrategy'} ,   compression={'sstable_compression': 'snappycompressor'}; 

2) using asynatax insert row.

operationresult<cqlresult<integer, string>> result = keyspace.preparequery(cql3_cf)     .withcql("insert event_tracking (key, column1, value) values ("+system.currenttimemillis()+","+timeuuidutils.gettimeuuid(system.currenttimemillis())+",'23232323');").execute(); 

but try add dynamic columns, not able recognize

operationresult<cqlresult<integer, string>> result = keyspace.preparequery(cql3_cf) .withcql("insert event_tracking (key, column1, value, userid, event) values ("+system.currenttimemillis()+","+timeuuidutils.gettimeuuid(system.currenttimemillis())+",'23232323', 123455, 'view');").execute();  

looks cannot add dynamic columns through cql3

3) if try add new column through cql3

alter table event_tracking add eventid bigint; 

it gives me

bad request: cannot add new column compact cf 

0) if create table compact storage pig should able see it, if create cql3. need put entityid , entitytype primary key work (compact storage means first column in primary key becomes row key , following become composite type used column key, , there room 1 more column value).

1) when create tables old way there value, it's value of column, , in cql3 represented column called value. how cql3 maps underlying storage model onto tables.

2) have created table columns of type compositetype(timeuuidtype), can add columns timeuuids. can't tell c* save string timeuuid column key.

3) looping 0 use table:

create table event_tracking (   key text,   trackingid timeuuid,   entityid bigint,   entitytype text,   userid bigint,   primary key (key, trackingid, entityid, entitytype) ) compact storage 

this 1 assumes there can 1 trackingid/entityid/entitytype combination each userid (what's inconsistent capitalization, btw?). that's not case need go full dynamic columns route, can't have different data types entityid , entitytype (but have been case before cql3 too), see question example of how dynamic columns: inserting arbitrary columns in cassandra using cql3


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -