[
https://issues.apache.org/jira/browse/CASSANDRA-15976?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Adam Holmberg reassigned CASSANDRA-15976:
-----------------------------------------
Assignee: Adam Holmberg
> Incorrect parsing of the timestamp with less than 3 digits in the milliseconds
> ------------------------------------------------------------------------------
>
> Key: CASSANDRA-15976
> URL: https://issues.apache.org/jira/browse/CASSANDRA-15976
> Project: Cassandra
> Issue Type: Bug
> Reporter: Alex Ott
> Assignee: Adam Holmberg
> Priority: Normal
>
> (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:
> {noformat}
> 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)
> {noformat}
> Checking with Instant:
> {noformat}
> 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
> {noformat}
> Imho it should be fixed (Cc: [~aholmber])
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]