Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.35.0
Description
The following test, when added to SqlOperatorTest, causes a RuntimeException:
@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"); }
Note that this needs https://github.com/apache/calcite/pull/3445 to execute correctly.
The stack trace is:
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)
According to the documentation DATE_PART is just an alias for EXTRACT, which is (mostly) implemented, so this should work.
Attachments
Issue Links
- links to