Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-7526

Assertion Error when only type is used with schema in table function

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.16.0
    • None
    • None
    • None

    Description

      org.apache.drill.TestSchemaWithTableFunction

        @Test
        public void testWithTypeAndSchema() {
          String query = "select Year from table(dfs.`store/text/data/cars.csvh`(type=> 'text', " +
            "schema=>'inline=(`Year` int)')) where Make = 'Ford'";
      
          queryBuilder().sql(query).print();
        }
      
      Caused by: java.lang.AssertionError: BOOLEAN
      	at org.apache.calcite.sql.type.SqlTypeExplicitPrecedenceList.compareTypePrecedence(SqlTypeExplicitPrecedenceList.java:140)
      	at org.apache.calcite.sql.SqlUtil.bestMatch(SqlUtil.java:687)
      	at org.apache.calcite.sql.SqlUtil.filterRoutinesByTypePrecedence(SqlUtil.java:656)
      	at org.apache.calcite.sql.SqlUtil.lookupSubjectRoutines(SqlUtil.java:515)
      	at org.apache.calcite.sql.SqlUtil.lookupRoutine(SqlUtil.java:435)
      	at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:240)
      	at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:218)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5640)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5627)
      	at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:139)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.deriveTypeImpl(SqlValidatorImpl.java:1692)
      	at org.apache.calcite.sql.validate.ProcedureNamespace.validateImpl(ProcedureNamespace.java:53)
      	at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1009)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:969)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3129)
      	at org.apache.drill.exec.planner.sql.conversion.DrillValidator.validateFrom(DrillValidator.java:63)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3111)
      	at org.apache.drill.exec.planner.sql.conversion.DrillValidator.validateFrom(DrillValidator.java:63)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3383)
      	at org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:60)
      	at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1009)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:969)
      	at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:216)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:944)
      	at org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:651)
      	at org.apache.drill.exec.planner.sql.conversion.SqlConverter.validate(SqlConverter.java:189)
      	at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.validateNode(DefaultSqlHandler.java:648)
      	at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.validateAndConvert(DefaultSqlHandler.java:196)
      	at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.getPlan(DefaultSqlHandler.java:170)
      	at org.apache.drill.exec.planner.sql.DrillSqlWorker.getQueryPlan(DrillSqlWorker.java:283)
      	at org.apache.drill.exec.planner.sql.DrillSqlWorker.getPhysicalPlan(DrillSqlWorker.java:163)
      	at org.apache.drill.exec.planner.sql.DrillSqlWorker.convertPlan(DrillSqlWorker.java:128)
      	at org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan(DrillSqlWorker.java:93)
      	at org.apache.drill.exec.work.foreman.Foreman.runSQL(Foreman.java:590)
      	at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:275)
      	... 1 more
      

      Note: when other format options are used or schema is used alone, everything works fine.
      See test examples: org.apache.drill.TestSchemaWithTableFunction#testSchemaInlineWithTableProperties, org.apache.drill.TestSchemaWithTableFunction#testSchemaInline).

      Attachments

        Issue Links

          Activity

            People

              volodymyr Vova Vysotskyi
              arina Arina Ielchiieva
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: