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

ClassCastException happens when combining filters with numeric and varchar literals

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

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

      Description

      Query:

      select * from cp.`tpch/nation.parquet` where n_nationkey < 5 or n_nationkey = '10'
      

      Expected result:
      The query should run successfully.

      Actual result:
      ClassCastException happens

      SYSTEM ERROR: ClassCastException: java.math.BigDecimal cannot be cast to org.apache.calcite.util.NlsString
      
      
      Please, refer to logs for more information.
      
      
        (org.apache.drill.exec.work.foreman.ForemanException) Unexpected exception during fragment initialization: Error while applying rule ReduceExpressionsRule(Filter), args [rel#565783:LogicalFilter.NONE.ANY([]).[](input=rel#565782:Subset#0.ENUMERABLE.ANY([]).[],condition=OR(<($1, 5), =($1, '10')))]
          org.apache.drill.exec.work.foreman.Foreman.run():300
          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(Filter), args [rel#565783:LogicalFilter.NONE.ANY([]).[](input=rel#565782:Subset#0.ENUMERABLE.ANY([]).[],condition=OR(<($1, 5), =($1, '10')))]
          org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch():236
          org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp():648
          org.apache.calcite.tools.Programs$RuleSetProgram.run():339
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.transform():431
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.transform():371
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToRawDrel():251
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToDrel():320
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.getPlan():177
          org.apache.drill.exec.planner.sql.DrillSqlWorker.getQueryPlan():155
          org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan():81
          org.apache.drill.exec.work.foreman.Foreman.runSQL():584
          org.apache.drill.exec.work.foreman.Foreman.run():272
          java.util.concurrent.ThreadPoolExecutor.runWorker():1149
          java.util.concurrent.ThreadPoolExecutor$Worker.run():624
          java.lang.Thread.run():748
        Caused By (java.lang.ClassCastException) java.math.BigDecimal cannot be cast to org.apache.calcite.util.NlsString
          org.apache.calcite.util.NlsString.compareTo():122
          com.google.common.collect.Range.compareOrThrow():672
          com.google.common.collect.Cut.compareTo():79
          com.google.common.collect.Range.encloses():497
          org.apache.calcite.rex.RexSimplify.residue():1037
          org.apache.calcite.rex.RexSimplify.simplifyUsingPredicates():979
          org.apache.calcite.rex.RexSimplify.simplifyComparison():288
          org.apache.calcite.rex.RexSimplify.simplifyComparison():218
          org.apache.calcite.rex.RexSimplify.simplify_():209
          org.apache.calcite.rex.RexSimplify.lambda$simplify$0():175
          org.apache.calcite.rex.RexSimplify.verify():1097
          org.apache.calcite.rex.RexSimplify.simplify():175
          org.apache.calcite.rex.RexSimplify.simplifyOrTerms():346
          org.apache.calcite.rex.RexSimplify.simplifyOr():1058
          org.apache.calcite.rex.RexSimplify.simplify_():183
          org.apache.calcite.rex.RexSimplify.lambda$simplify$0():175
          org.apache.calcite.rex.RexSimplify.verify():1097
          org.apache.calcite.rex.RexSimplify.simplify():175
          org.apache.calcite.rex.RexUtil$ExprSimplifier.visitCall():2607
          org.apache.calcite.rex.RexUtil$ExprSimplifier.visitCall():2567
          org.apache.calcite.rex.RexCall.accept():107
          org.apache.calcite.rex.RexShuttle.apply():279
          org.apache.calcite.rel.rules.ReduceExpressionsRule.reduceExpressions():547
          org.apache.calcite.rel.rules.ReduceExpressionsRule$FilterReduceExpressionsRule.onMatch():163
          org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch():212
          org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp():648
          org.apache.calcite.tools.Programs$RuleSetProgram.run():339
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.transform():431
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.transform():371
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToRawDrel():251
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.convertToDrel():320
          org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.getPlan():177
          org.apache.drill.exec.planner.sql.DrillSqlWorker.getQueryPlan():155
          org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan():81
          org.apache.drill.exec.work.foreman.Foreman.runSQL():584
          org.apache.drill.exec.work.foreman.Foreman.run():272
          java.util.concurrent.ThreadPoolExecutor.runWorker():1149
          java.util.concurrent.ThreadPoolExecutor$Worker.run():624
          java.lang.Thread.run():748
      

        Attachments

        Issue Links

          Activity

            People

            • Assignee:
              ihuzenko Igor Guzenko
              Reporter:
              angozhiy Anton Gozhiy

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment