Reputation: 71
I am inserting in time using timestamp datatype but it cannot give me values in microseconds. Is it possible to insert values in microseconds or it takes values only up to milliseconds.
cqlsh:cassandradb> select * from time_stamp;
id | name | t
----+---------+---------------------------------
1 | deepank | 2015-02-16 06:30:24.000000+0000
2 | arun | 2016-02-16 06:35:24.483000+0000
this is what I have inserted but I am not expecting this value. I have simply inserted value in milliseconds when I insert in micro it gives me error as following (2 rows) cqlsh:cassandradb> select id, name, blobAsBigint(timestampAsBlob(t)) from time_ stamp;
id | name | system.blobasbigint(system.timestampasblob(t))
----+---------+------------------------------------------------
1 | deepank | 1424068224000
2 | arun | 1455604524483
(2 rows) In this, I have used blob but I think it didn't go well.
cqlsh:cassandradb> insert into time_stamp(id,name, t)values(3,'tarun','2015-02-16 06:30:2.84325');
InvalidRequest: Error from server: code=2200 [Invalid query] message="Unable to coerce '2015-02-16 06:30:2.84325' to a formatted date (long)"
cqlsh:cassandradb> insert into time_stamp(id,name, t)values(3,'tarun','2015-02-16 06:30:2.8432');
InvalidRequest: Error from server: code=2200 [Invalid query] message="Unable to coerce '2015-02-16 06:30:2.8432' to a formatted date (long)"
cqlsh:cassandradb> insert into time_stamp(id,name, t)values(3,'tarun','2015-02-16 06:30:2.842');``
last value is taken
I expect that it could insert value in microseconds; so that output will be in six digit.
Upvotes: 1
Views: 117
Reputation: 87359
Timestamp in Cassandra has millisecond resolution, and you should use only 3 digits after .
in timestamp string. The microsecond resolution is used only for WriteTime of the record.
For some, unknown for me, reason, cqlsh
outputs data with microseconds resolution, and imho it's huge UX problem with it...
Upvotes: 3