Details
-
Bug
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
None
-
Correctness - API / Semantic Implementation
-
Normal
-
Normal
-
User Report
-
All
-
Docs
-
Description
(tested on 4.0-beta1, but should be in all versions)
Right now, Cassandra incorrectly handles timestamps with less than 3 digits in the milliseconds part. Timestamps (valid from the Java point of view (see below output in Scala) are either rejected (if we have 1 digit only), or incorrectly parsed when 2 digits are specified:
cqlsh> create table test.tm (id int primary key, tm timestamp); cqlsh> insert into test.tm(id, tm) values (2, '2020-07-24T10:00:01.2Z'); InvalidRequest: Error from server: code=2200 [Invalid query] message="Unable to coerce '2020-07-24T10:00:01.2Z' to a formatted date (long)" cqlsh> insert into test.tm(id, tm) values (1, '2020-07-24T10:00:01.12Z'); cqlsh> select * from test.tm; id | tm ----+--------------------------------- 1 | 2020-07-24 10:00:01.012000+0000 (1 rows)
Checking with Instant:
scala> java.time.Instant.parse("2020-07-24T10:00:01.12Z") res0: java.time.Instant = 2020-07-24T10:00:01.120Z scala> java.time.Instant.parse("2020-07-24T10:00:01.2Z") res1: java.time.Instant = 2020-07-24T10:00:01.200Z
Imho it should be fixed (Cc: Adam Holmberg)
Attachments
Attachments
Issue Links
- breaks
-
CASSANDRA-17467 Timestamp issue with Cassandra 4.0.3 with Timezone value
- Resolved
- Dependent
-
CASSANDRA-14853 Change default timestamp format to output only milliseconds, not microseconds
- Resolved