Is it possible to use a timestamp in ms since epoch in select statement for Cassandra? -
i know using formats listed here (http://docs.datastax.com/en/cql/3.0/cql/cql_reference/timestamp_type_r.html) work query cassandra. however, i'm having hard time determining if possible use ms since epoch in select statement.
i feel should since data can sent cassandra in ms since epoch (from above: timestamp type can entered integer cql input), attempts have failed , can't find documentation saying either way.
thanks!
yes, can use integer timestamps in select statements.
cassandra@cqlsh:testkeyspace> create table test (key int, ts timestamp, v int, primary key (key, ts)); cassandra@cqlsh:testkeyspace> insert test (key, ts, v) values (0, 1434741481000, 0); cassandra@cqlsh:testkeyspace> insert test (key, ts, v) values (0, 1434741481001, 1); cassandra@cqlsh:testkeyspace> insert test (key, ts, v) values (0, 1434741481002, 2); cassandra@cqlsh:testkeyspace> select ts, v test key = 0; ts | v --------------------------+--- 2015-06-19 14:18:01-0500 | 0 2015-06-19 14:18:01-0500 | 1 2015-06-19 14:18:01-0500 | 2 (3 rows) cassandra@cqlsh:testkeyspace> select ts, v test key=0 , ts >= 1434741481001; ts | v --------------------------+--- 2015-06-19 14:18:01-0500 | 1 2015-06-19 14:18:01-0500 | 2 (2 rows)
Comments
Post a Comment