You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Mihai Budiu (Jira)" <ji...@apache.org> on 2023/02/22 18:53:00 UTC

[jira] [Commented] (CALCITE-5538) TimestampString rejects timestamp literals that end with 0 after the period

    [ https://issues.apache.org/jira/browse/CALCITE-5538?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17692319#comment-17692319 ] 

Mihai Budiu commented on CALCITE-5538:
--------------------------------------

I have tried to create a test case, and I notice that the SQL parser actually goes through DateTimeUtils.parsePrecisionDateTimeLiteral, which parses correctly values after the decimal point.
So this is not really a problem of the SQL parser, but only a problem of this internal class.
I still think it's worth fixing, though, but since this internal class has no unit tests, I don't know how to write a test that exercises this path.

> TimestampString rejects timestamp literals that end with 0 after the period
> ---------------------------------------------------------------------------
>
>                 Key: CALCITE-5538
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5538
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.33.0
>            Reporter: Mihai Budiu
>            Priority: Trivial
>
> The root cause is that the TimestampString constructor validates a string argument with the following regular expression: ??"[0-9][0-9][0-9][0-9]{-}[0-9][0-9]{-}[0-9][0-9]"
>           + " "
>           + "[0-9][0-9]:[0-9][0-9]:[0-9][0-9](.[0-9]*[1-9])?"??
> Unfortunately this rejects perfectly legal timestamp strings such as "2023-02-21 10:10:10.000".
> The fix is trivial, if we agree that this is a bug. Is there a deeper reason for this validation?
> There seem to be no unit tests for this TimestampString constructor.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)