You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Mihai Budiu (Jira)" <ji...@apache.org> on 2023/10/16 20:47:00 UTC

[jira] [Updated] (CALCITE-6030) DATE_PART is not handled by the RexToLixTranslator

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

Mihai Budiu updated CALCITE-6030:
---------------------------------
    Fix Version/s: 1.36.0

> 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
>            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)