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

Sql. SELECT SUBSTR(1000, 1.0). Error: Was not expecting value 'INTEGER' for enumeration

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • sql

    Description

      assertQuery("SELECT SUBSTR(1000, 1.0)").returns("100").check();
      

      Result:

       Was not expecting value 'INTEGER' for enumeration 'org.apache.calcite.sql.type.SqlTypeName' in this context
      
      	at org.apache.ignite.internal.lang.SqlExceptionMapperUtil.mapToPublicSqlException(SqlExceptionMapperUtil.java:61)
      	at org.apache.ignite.internal.sql.engine.prepare.PrepareServiceImpl.lambda$prepareAsync$0(PrepareServiceImpl.java:246)
      	at java.base/java.util.concurrent.CompletableFuture.uniExceptionally(CompletableFuture.java:986)
      	at java.base/java.util.concurrent.CompletableFuture$UniExceptionally.tryFire(CompletableFuture.java:970)
      	at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
      	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1705)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:829)
      	Suppressed: java.lang.RuntimeException: This is a trimmed root
      		at org.apache.ignite.internal.testframework.IgniteTestUtils.await(IgniteTestUtils.java:801)
      		at org.apache.ignite.internal.testframework.IgniteTestUtils.await(IgniteTestUtils.java:819)
      		at org.apache.ignite.internal.sql.engine.util.QueryCheckerImpl.check(QueryCheckerImpl.java:352)
      		at org.apache.ignite.internal.sql.engine.util.QueryCheckerFactoryImpl$1.check(QueryCheckerFactoryImpl.java:98)
      		at org.apache.ignite.internal.sql.engine.ItFunctionsTest.testSubstr(ItFunctionsTest.java:281)
      		at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      		at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
      		at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
      Caused by: org.apache.ignite.lang.IgniteException: IGN-CMN-65535 TraceId:f9c2530d-fd02-4afb-85da-745cc940fc15 Was not expecting value 'INTEGER' for enumeration 'org.apache.calcite.sql.type.SqlTypeName' in this context
      	at org.apache.ignite.internal.lang.IgniteExceptionMapperUtil.lambda$mapToPublicException$2(IgniteExceptionMapperUtil.java:88)
      	at org.apache.ignite.internal.lang.IgniteExceptionMapperUtil.mapCheckingResultIsPublic(IgniteExceptionMapperUtil.java:141)
      	at org.apache.ignite.internal.lang.IgniteExceptionMapperUtil.mapToPublicException(IgniteExceptionMapperUtil.java:110)
      	at org.apache.ignite.internal.lang.IgniteExceptionMapperUtil.mapToPublicException(IgniteExceptionMapperUtil.java:88)
      	at org.apache.ignite.internal.lang.SqlExceptionMapperUtil.mapToPublicSqlException(SqlExceptionMapperUtil.java:51)
      	... 8 more
      Caused by: java.lang.AssertionError: Was not expecting value 'INTEGER' for enumeration 'org.apache.calcite.sql.type.SqlTypeName' in this context
      	at org.apache.calcite.util.Util.unexpected(Util.java:1928)
      	at org.apache.calcite.sql.type.SqlTypeTransforms$1.toVar(SqlTypeTransforms.java:191)
      	at org.apache.calcite.sql.type.SqlTypeTransforms$1.transformType(SqlTypeTransforms.java:158)
      	at org.apache.calcite.sql.type.SqlTypeTransformCascade.inferReturnType(SqlTypeTransformCascade.java:66)
      	at org.apache.calcite.sql.SqlOperator.inferReturnType(SqlOperator.java:534)
      	at org.apache.calcite.sql.SqlOperator.validateOperands(SqlOperator.java:503)
      	at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:347)
      	at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:231)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:6714)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:6701)
      	at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:166)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.deriveTypeImpl(SqlValidatorImpl.java:1955)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.deriveType(SqlValidatorImpl.java:1942)
      	at org.apache.ignite.internal.sql.engine.prepare.IgniteSqlValidator.deriveType(IgniteSqlValidator.java:579)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.expandSelectItem(SqlValidatorImpl.java:495)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelectList(SqlValidatorImpl.java:4784)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3892)
      	at org.apache.ignite.internal.sql.engine.prepare.IgniteSqlValidator.validateSelect(IgniteSqlValidator.java:494)
      	at org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:61)
      	at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:95)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1164)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:1135)
      	at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:282)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:1101)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:807)
      	at org.apache.ignite.internal.sql.engine.prepare.IgniteSqlValidator.validate(IgniteSqlValidator.java:171)
      

      the SUBSTRING function produces another error:

      assertQuery("SELECT SUBSTRING(1000, 1.0)").returns("100").check();
      

      Result:

      while resolving method 'substring[class java.lang.String, class java.math.BigDecimal]' in class class org.apache.calcite.runtime.SqlFunctions
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mzhuravkov Maksim Zhuravkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: