You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2023/12/04 09:15:00 UTC

[jira] [Updated] (CALCITE-6115) Interval type specifier with zero fractional second precision does not pass validation

     [ https://issues.apache.org/jira/browse/CALCITE-6115?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ASF GitHub Bot updated CALCITE-6115:
------------------------------------
    Labels: pull-request-available  (was: )

> Interval type specifier with zero fractional second precision does not pass validation
> --------------------------------------------------------------------------------------
>
>                 Key: CALCITE-6115
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6115
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Leonid Chistov
>            Assignee: Leonid Chistov
>            Priority: Major
>              Labels: pull-request-available
>
> Consider interval expression 
> {code:java}
> interval '1' second(1, 0) {code}
> Calcite SQL validator considers it as not correct, since it uses following lower bound for fractional seconds precision:
> {code:java}
> public static final int MIN_INTERVAL_FRACTIONAL_SECOND_PRECISION = 1;{code}
> In order to reproduce this issue one can add following test cast to SqlValidatorTest.java:
> {code:java}
> @Test void testSecondIntervalExpression() {
>   expr("interval '1' second(1, 0)").columnType("INTERVAL SECOND(1, 0) NOT NULL");
> } {code}
> and get an error:
> {code:java}
> Interval fractional second precision '0' out of range for INTERVAL SECOND(1, 0) {code}
> However, SQL standard say:
> {code:java}
> An <interval fractional seconds precision>, if specified, shall be greater than or equal to 0 (zero)
> and shall not be greater than the implementation-defined maximum. If SECOND is specified
> and <interval fractional seconds precision> is not specified, then an <interval fractional seconds
> precision> of 6 is implicit. {code}
> Consequently, MIN_INTERVAL_FRACTIONAL_SECOND_PRECISION should be equal to 0 to make Calcite behavior consistent with SQL specification.



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