You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2024/04/03 18:38:00 UTC

[jira] [Commented] (CALCITE-6345) Intervals with more than 100 years are not supported

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

Julian Hyde commented on CALCITE-6345:
--------------------------------------

Can you reframe this as a feature request, rather than a bug?

> Intervals with more than 100 years are not supported
> ----------------------------------------------------
>
>                 Key: CALCITE-6345
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6345
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.36.0
>            Reporter: Mihai Budiu
>            Priority: Minor
>              Labels: pull-request-available
>
> Adding the following SqlValidatorTest:
> {code:java}
>     expr("INTERVAL '100-2' YEAR TO MONTH").assertInterval(is(122L));
> {code}
> causes the following exception:
> {code}
> org.apache.calcite.runtime.CalciteContextException: From line 1, column 9 to line 1, column 38: Interval field value 100 exceeds precision of YEAR(2) field
> 	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> 	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> 	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> 	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
> 	at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:507)
> 	at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:948)
> 	at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:933)
> 	at org.apache.calcite.sql.SqlIntervalQualifier.fieldExceedsPrecisionException(SqlIntervalQualifier.java:1355)
> 	at org.apache.calcite.sql.SqlIntervalQualifier.checkLeadFieldInRange(SqlIntervalQualifier.java:475)
> 	at org.apache.calcite.sql.SqlIntervalQualifier.evaluateIntervalLiteralAsYearToMonth(SqlIntervalQualifier.java:626)
> 	at org.apache.calcite.sql.SqlIntervalQualifier.evaluateIntervalLiteral(SqlIntervalQualifier.java:1293)
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateLiteral(SqlValidatorImpl.java:3429)
> {code}
> The spec does not limit years to 2 digits, so I don't know where the YEAR(2) time is coming from.



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