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

Mihai Budiu resolved CALCITE-6015.
----------------------------------
    Resolution: Fixed

Fixed in 
https://github.com/apache/calcite/commit/4823cb7760913f236e7f0f2cb149325b55a3f124

> AssertionError during optimization of EXTRACT expression
> --------------------------------------------------------
>
>                 Key: CALCITE-6015
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6015
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.35.0
>            Reporter: Mihai Budiu
>            Assignee: Mihai Budiu
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 1.37.0
>
>
> The following test added to RelOptRules test causes an AssertionError:
> {code:java}
>   @Test void testExtractDayFromTime() {
>     final String sql = "select EXTRACT(DAY FROM TIME'10:00:00')";
>     sql(sql).withRule(CoreRules.PROJECT_REDUCE_EXPRESSIONS)
>         .check();
>   }
> {code}
> The bottom of the stack trace is:
> {code:java}
> java.lang.AssertionError: unexpected TIME
>       at 
> org.apache.calcite.adapter.enumerable.RexImpTable$ExtractImplementor.implementSafe(RexImpTable.java:3056)
>       at 
> org.apache.calcite.adapter.enumerable.RexImpTable$AbstractRexCallImplementor.genValueStatement(RexImpTable.java:3796)
>       at 
> org.apache.calcite.adapter.enumerable.RexImpTable$AbstractRexCallImplementor.implement(RexImpTable.java:3758)
>       at 
> org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitCall(RexToLixTranslator.java:1184)
>       at 
> org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitCall(RexToLixTranslator.java:101)
>       at org.apache.calcite.rex.RexCall.accept(RexCall.java:189)
> {code}
> This expression is indeed illegal. Perhaps validation should produce an error?



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

Reply via email to