Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-1175

extract() from PostgreSQL timestamp column throws org.apache.calcite.sql.SqlSyntax$6: SPECIAL

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.8.0
    • 1.15.0
    • core
    • None
    • PostgreSQL

    Description

      select extract(hour from "cts") from "public"."tts";

      This query throws next exception:

      0: jdbc:calcite:model=postgres.json> select extract(hour from "cts") from "public"."tts";
      Error: Error while executing SQL "select extract(hour from "cts") from "public"."tts"": class org.apache.calcite.sql.SqlSyntax$6: SPECIAL (state=,code=0)
      java.sql.SQLException: Error while executing SQL "select extract(hour from "cts") from "public"."tts"": class org.apache.calcite.sql.SqlSyntax$6: SPECIAL
      	at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
      	at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
      	at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:143)
      	at org.apache.calcite.avatica.AvaticaStatement.execute(AvaticaStatement.java:177)
      	at sqlline.Commands.execute(Commands.java:822)
      	at sqlline.Commands.sql(Commands.java:732)
      	at sqlline.SqlLine.dispatch(SqlLine.java:807)
      	at sqlline.SqlLine.begin(SqlLine.java:681)
      	at sqlline.SqlLine.start(SqlLine.java:398)
      	at sqlline.SqlLine.main(SqlLine.java:292)
      Caused by: java.lang.UnsupportedOperationException: class org.apache.calcite.sql.SqlSyntax$6: SPECIAL
      	at org.apache.calcite.util.Util.needToImplement(Util.java:924)
      	at org.apache.calcite.sql.SqlSyntax$6.unparse(SqlSyntax.java:115)
      	at org.apache.calcite.sql.SqlOperator.unparse(SqlOperator.java:331)
      	at org.apache.calcite.sql.SqlCall.unparse(SqlCall.java:100)
      	at org.apache.calcite.sql.SqlUtil.unparseFunctionSyntax(SqlUtil.java:272)
      	at org.apache.calcite.sql.SqlSyntax$1.unparse(SqlSyntax.java:35)
      	at org.apache.calcite.sql.SqlFunction.unparse(SqlFunction.java:171)
      	at org.apache.calcite.sql.SqlCall.unparse(SqlCall.java:100)
      	at org.apache.calcite.sql.SqlUtil.unparseBinarySyntax(SqlUtil.java:289)
      	at org.apache.calcite.sql.SqlSyntax$3.unparse(SqlSyntax.java:64)
      	at org.apache.calcite.sql.SqlOperator.unparse(SqlOperator.java:331)
      	at org.apache.calcite.sql.SqlCall.unparse(SqlCall.java:100)
      	at org.apache.calcite.sql.SqlNodeList.commaList(SqlNodeList.java:121)
      	at org.apache.calcite.sql.SqlOperator.unparseListClause(SqlOperator.java:348)
      	at org.apache.calcite.sql.SqlOperator.unparseListClause(SqlOperator.java:337)
      	at org.apache.calcite.sql.SqlSelectOperator.unparse(SqlSelectOperator.java:151)
      	at org.apache.calcite.sql.SqlSelect.unparse(SqlSelect.java:222)
      	at org.apache.calcite.sql.SqlNode.toSqlString(SqlNode.java:149)
      	at org.apache.calcite.sql.SqlNode.toSqlString(SqlNode.java:155)
      	at org.apache.calcite.adapter.jdbc.JdbcToEnumerableConverter.generateSql(JdbcToEnumerableConverter.java:300)
      	at org.apache.calcite.adapter.jdbc.JdbcToEnumerableConverter.implement(JdbcToEnumerableConverter.java:91)
      	at org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.implementRoot(EnumerableRelImplementor.java:102)
      	at org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:92)
      	at org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1172)
      	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:294)
      	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:193)
      	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:720)
      	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:587)
      	at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:557)
      	at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:214)
      	at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:573)
      	at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:581)
      	at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:135)
      	... 7 more
      

      Preconditions:

      create table tts(rnum integer not null, cts timestamp(3));
      

      Attachments

        Issue Links

          Activity

            People

              julianhyde Julian Hyde
              dr-wolf Taras Supyk
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: