[
https://issues.apache.org/jira/browse/CASSANDRA-15976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17175849#comment-17175849
]
Adam Holmberg edited comment on CASSANDRA-15976 at 8/11/20, 9:30 PM:
---------------------------------------------------------------------
[potential
solution|https://github.com/apache/cassandra/compare/trunk...aholmberg:CASSANDRA-15976]
[link title|http://example.com]
I first expanded unit tests to characterize existing parsing, and also to
actually validate parsed values.
The patch introduces DateTimeFormatter for parsing internally. I verified with
some basic local microbenchmarks that this parsing is also much faster – up to
10x depending on the inputs.
was (Author: aholmber):
[potential
solution|[https://github.com/apache/cassandra/compare/trunk...aholmberg:CASSANDRA-15976]]
I first expanded unit tests to characterize existing parsing, and also to
actually validate parsed values.
The patch introduces DateTimeFormatter for parsing internally. I verified with
some basic local microbenchmarks that this parsing is also much faster – up to
10x depending on the inputs.
> 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
> Components: CQL/Interpreter
> Reporter: Alex Ott
> Assignee: Adam Holmberg
> Priority: Normal
> Fix For: 4.0-beta2
>
>
> (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]