Custom data types and dynamic tables

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Custom data types and dynamic tables

Anishek Agarwal
Hello,

If i have a custom type EventDefinition and i create a table like


create table TestTable {
user_id long,
ts timestamp,
definition 'com.anishek.EventDefinition',
Primary Key (user_id, ts))
with clustering order by (ts desc) and compression={'sstable_compression' : 'SnappyCompressor'}
and compaction = {'class': 'DateTieredCompactionStrategy', 'base_time_seconds':'3600', 'max_sstable_age_days':'30'};


then how would the data stored internally, based on http://www.datastax.com/dev/blog/thrift-to-cql3
"Dynamic Column Family"  section would the data be as below given EventDefinition results in storing the following string representation "code, eventName

Row : Columns

1      :  2015-03-02 14:33:14+0000="12,a"
           2015-03-02 14:34:14+0000="11,b"
           2015-03-02 14:35:14+0000="15,e"
           2015-03-02 14:36:14+0000="17,c"
           2015-03-02 14:37:14+0000="1,d"
2       : 2015-03-02 14:33:14+0000="12,a"
           2015-03-02 14:34:14+0000="11,b"
           2015-03-02 14:35:14+0000="15,e"
           2015-03-02 14:36:14+0000="17,c"
           2015-03-02 14:37:14+0000="1,d"

Is the above correct ?

We will be getting above events per day for a user and new users keep getting added to the system. We are presently assuming that we might have about 30 events at max for a given user.

Given we will add data like

insert into TestTable(user_id,ts, definition) values(a, "2015-03-02 12:30:56", "1,s") using ttl [30 days];

I am assuming that date tired compaction will not be very effective if the timestamp is not in the same timezone across entries.

thanks
Anishek