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

(type|sqlType|drillType|mode)Of functions fail when used with constants

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.14.0
    • Fix Version/s: 1.16.0
    • Component/s: None
    • Labels:

      Description

      Affected functions: typeOf, sqlTypeOf, drillTypeOf, modeOf

      Example:

      0: jdbc:drill:drillbit=localhost> select typeOf(1) from (values(1));
      Error: SYSTEM ERROR: IllegalArgumentException: Can not set org.apache.drill.exec.vector.complex.reader.FieldReader field org.apache.drill.exec.expr.fn.impl.UnionFunctions$GetType.input to org.apache.drill.exec.expr.holders.IntHolder
      
      
      [Error Id: 709cf2f7-7396-4034-8c5a-e94d78504297 on cv1:31010]
      
        (org.apache.drill.exec.work.foreman.ForemanException) Unexpected exception during fragment initialization: Error while applying rule ReduceExpressionsRule(Project), args [rel#3945:LogicalProject.NONE.ANY([]).[](input=rel#3944:Subset#0.NONE.ANY([]).[0],EXPR$0=TYPEOF(1))]
          org.apache.drill.exec.work.foreman.Foreman.run():294
          java.util.concurrent.ThreadPoolExecutor.runWorker():1149
          java.util.concurrent.ThreadPoolExecutor$Worker.run():624
          java.lang.Thread.run():748
        Caused By (java.lang.RuntimeException) Error while applying rule ReduceExpressionsRule(Project), args [rel#3945:LogicalProject.NONE.ANY([]).[](input=rel#3944:Subset#0.NONE.ANY([]).[0],EXPR$0=TYPEOF(1))]
          org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch():236
          org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp():652
          org.apache.calcite.tools.Programs$RuleSetProgram.run():368
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.transform():426
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.transform():366
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToRawDrel():255
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToDrel():315
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.getPlan():180
          org.apache.drill.exec.planner.sql.DrillSqlWorker.getQueryPlan():145
          org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan():83
          org.apache.drill.exec.work.foreman.Foreman.runSQL():567
          org.apache.drill.exec.work.foreman.Foreman.run():266
          java.util.concurrent.ThreadPoolExecutor.runWorker():1149
          java.util.concurrent.ThreadPoolExecutor$Worker.run():624
          java.lang.Thread.run():748
        Caused By (java.lang.RuntimeException) Error in evaluating function of typeof
          org.apache.drill.exec.expr.fn.interpreter.InterpreterEvaluator$EvalVisitor.visitFunctionHolderExpression():347
          org.apache.drill.exec.expr.fn.interpreter.InterpreterEvaluator$EvalVisitor.visitFunctionHolderExpression():194
          org.apache.drill.common.expression.FunctionHolderExpression.accept():53
          org.apache.drill.exec.expr.fn.interpreter.InterpreterEvaluator.evaluateConstantExpr():69
          org.apache.drill.exec.planner.logical.DrillConstExecutor.reduce():150
          org.apache.calcite.rel.rules.ReduceExpressionsRule.reduceExpressionsInternal():620
          org.apache.calcite.rel.rules.ReduceExpressionsRule.reduceExpressions():540
          org.apache.calcite.rel.rules.ReduceExpressionsRule$ProjectReduceExpressionsRule.onMatch():288
          org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch():212
          org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp():652
          org.apache.calcite.tools.Programs$RuleSetProgram.run():368
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.transform():426
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.transform():366
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToRawDrel():255
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToDrel():315
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.getPlan():180
          org.apache.drill.exec.planner.sql.DrillSqlWorker.getQueryPlan():145
          org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan():83
          org.apache.drill.exec.work.foreman.Foreman.runSQL():567
          org.apache.drill.exec.work.foreman.Foreman.run():266
          java.util.concurrent.ThreadPoolExecutor.runWorker():1149
          java.util.concurrent.ThreadPoolExecutor$Worker.run():624
          java.lang.Thread.run():748
        Caused By (java.lang.IllegalArgumentException) Can not set org.apache.drill.exec.vector.complex.reader.FieldReader field org.apache.drill.exec.expr.fn.impl.UnionFunctions$GetType.input to org.apache.drill.exec.expr.holders.IntHolder
          sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException():167
          sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException():171
          sun.reflect.UnsafeObjectFieldAccessorImpl.set():81
          java.lang.reflect.Field.set():764
          org.apache.drill.exec.expr.fn.interpreter.InterpreterEvaluator.evaluateFunction():106
          org.apache.drill.exec.expr.fn.interpreter.InterpreterEvaluator$EvalVisitor.visitFunctionHolderExpression():334
          org.apache.drill.exec.expr.fn.interpreter.InterpreterEvaluator$EvalVisitor.visitFunctionHolderExpression():194
          org.apache.drill.common.expression.FunctionHolderExpression.accept():53
          org.apache.drill.exec.expr.fn.interpreter.InterpreterEvaluator.evaluateConstantExpr():69
          org.apache.drill.exec.planner.logical.DrillConstExecutor.reduce():150
          org.apache.calcite.rel.rules.ReduceExpressionsRule.reduceExpressionsInternal():620
          org.apache.calcite.rel.rules.ReduceExpressionsRule.reduceExpressions():540
          org.apache.calcite.rel.rules.ReduceExpressionsRule$ProjectReduceExpressionsRule.onMatch():288
          org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch():212
          org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp():652
          org.apache.calcite.tools.Programs$RuleSetProgram.run():368
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.transform():426
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.transform():366
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToRawDrel():255
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToDrel():315
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.getPlan():180
          org.apache.drill.exec.planner.sql.DrillSqlWorker.getQueryPlan():145
          org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan():83
          org.apache.drill.exec.work.foreman.Foreman.runSQL():567
          org.apache.drill.exec.work.foreman.Foreman.run():266
          java.util.concurrent.ThreadPoolExecutor.runWorker():1149
          java.util.concurrent.ThreadPoolExecutor$Worker.run():624
          java.lang.Thread.run():748 (state=,code=0)
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: