Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-23278

Calcite. Incorrect error with TIMESTAMP WITH TIME ZONE type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.14
    • 2.17
    • None
    • SQL Calcite: Fixed incorrect error for TIME* WITH TIME ZONE types
    • Release Notes Required

    Description

      Wrong error on TIMESTAMP WITH TIME ZONE type even if we do not support it. Not a 'null type' or NPE.

      Reproducer:

      sql("CREATE TABLE test (val TIMESTAMP WITH TIME ZONE)");
      

      Error:

      java.lang.NullPointerException: null
      	at org.apache.ignite.internal.processors.query.calcite.exec.ddl.DdlCommandHandler.toQueryEntity(DdlCommandHandler.java:330) ~[classes/:?]
      	at org.apache.ignite.internal.processors.query.calcite.exec.ddl.DdlCommandHandler.handle0(DdlCommandHandler.java:141) ~[classes/:?]
      	at org.apache.ignite.internal.processors.query.calcite.exec.ddl.DdlCommandHandler.handle(DdlCommandHandler.java:106) ~[classes/:?]
      	at org.apache.ignite.internal.processors.query.calcite.exec.ExecutionServiceImpl.executeDdl(ExecutionServiceImpl.java:528) ~[classes/:?]
      	at org.apache.ignite.internal.processors.query.calcite.exec.ExecutionServiceImpl.executePlan(ExecutionServiceImpl.java:518) ~[classes/:?]
      	at org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.lambda$parseAndProcessQuery$6(CalciteQueryProcessor.java:530) ~[classes/:?]
      	at org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.processQuery(CalciteQueryProcessor.java:641) ~[classes/:?]
      	at org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.parseAndProcessQuery(CalciteQueryProcessor.java:518) ~[classes/:?]
      	at org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.query(CalciteQueryProcessor.java:393) ~[classes/:?]
      

      Or

      sql("CREATE TABLE test (val TIMESTAMP)");
      
      sql("INSERT INTO test VALUES (CAST('2024-07-22 12:00:00 -02:00' as TIMESTAMP WITH TIME ZONE))")
      

      Error:

      java.lang.RuntimeException: unsupported type null
      	at org.apache.calcite.linq4j.tree.Types.toClass(Types.java:152) ~[calcite-linq4j-1.37.0.jar:1.37.0]
      	at org.apache.calcite.linq4j.tree.Types.isAssignableFrom(Types.java:233) ~[calcite-linq4j-1.37.0.jar:1.37.0]
      	at org.apache.calcite.linq4j.tree.Types.needTypeCast(Types.java:476) ~[calcite-linq4j-1.37.0.jar:1.37.0]
      	at org.apache.ignite.internal.processors.query.calcite.exec.exp.ConverterUtils.convert(ConverterUtils.java:224) ~[classes/:?]
      	at org.apache.ignite.internal.processors.query.calcite.exec.exp.ConverterUtils.convert(ConverterUtils.java:195) ~[classes/:?]
      	at org.apache.ignite.internal.processors.query.calcite.exec.exp.ConverterUtils.convert(ConverterUtils.java:183) ~[classes/:?]
      	at org.apache.ignite.internal.processors.query.calcite.exec.exp.RexToLixTranslator.translateCast(RexToLixTranslator.java:558) ~[classes/:?]
      	at org.apache.ignite.internal.processors.query.calcite.exec.exp.RexImpTable$CastImplementor.implementSafe(RexImpTable.java:1535) ~[classes/:?]
      	at org.apache.ignite.internal.processors.query.calcite.exec.exp.RexImpTable$AbstractRexCallImplementor.genValueStatement(RexImpTable.java:1956) ~[classes/:?]
      	at org.apache.ignite.internal.processors.query.calcite.exec.exp.RexImpTable$AbstractRexCallImplementor.implement(RexImpTable.java:1917) ~[classes/:?]
      	at org.apache.ignite.internal.processors.query.calcite.exec.exp.RexToLixTranslator.visitCall(RexToLixTranslator.java:1052) ~[classes/:?]
      	at org.apache.ignite.internal.processors.query.calcite.exec.exp.RexToLixTranslator.visitCall(RexToLixTranslator.java:81) ~[classes/:?]
      ....
      

      Attachments

        Issue Links

          Activity

            People

              vladsz83 Vladimir Steshin
              vladsz83 Vladimir Steshin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: