Leonid Chistov created CALCITE-6115: ---------------------------------------
Summary: 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 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)