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

Mihai Budiu reassigned CALCITE-6030:
------------------------------------

    Assignee: Mihai Budiu

> DATE_PART is not handled by the RexToLixTranslator
> --------------------------------------------------
>
>                 Key: CALCITE-6030
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6030
>             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.36.0
>
>
> The following test, when added to SqlOperatorTest, causes a RuntimeException:
> {code:java}
> @Test void testDatePart() {
>     final SqlOperatorFixture f = fixture().withLibrary(SqlLibrary.POSTGRESQL)
>         .withParserConfig(p -> 
> p.withParserFactory(SqlBabelParserImpl.FACTORY));
>     f.checkScalar("DATE_PART(second, TIME '10:10:10')",
>         "10", "BIGINT NOT NULL");
>   }
> {code}
> Note that this needs https://github.com/apache/calcite/pull/3445 to execute 
> correctly.
> The stack trace is:
> {code:java}
> Suppressed: java.lang.RuntimeException: cannot translate call DATE_PART($t1, 
> $t2)
>               at 
> org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitCall(RexToLixTranslator.java:1160)
>               at 
> org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitCall(RexToLixTranslator.java:101)
>               at org.apache.calcite.rex.RexCall.accept(RexCall.java:189)
> {code}
> According to the documentation DATE_PART is just an alias for EXTRACT, which 
> is (mostly) implemented, so this should work.



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

Reply via email to