Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-14384

CBO: Decimal constant folding is failing

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.2.0
    • 2.3.0
    • CBO
    • None

    Description

      explain select sum(l_extendedprice * l_discount) as revenue from lineitem where l_shipdate >= '1993-01-01' and l_shipdate < '1994-01-01' and l_discount between 0.06 - 0.01 and 0.06 + 0.01 and l_quantity < 25;
      

      Fails CBO because of constant folding errors.

      2016-07-29T17:15:50,921 ERROR [0b3f62eb-8a80-40cd-8cf2-60bc835191a8 main] parse.CalcitePlanner: CBO failed, skipping CBO.
      java.lang.IllegalArgumentException: Decimal scale must be less than or equal to precision
              at org.apache.hadoop.hive.serde2.typeinfo.HiveDecimalUtils.validateParameter(HiveDecimalUtils.java:53) ~[hive-exec-2.2.0-SNAPSHOT.jar:2.2.0-SNAPSHOT]
              at org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo.<init>(DecimalTypeInfo.java:36) ~[hive-exec-2.2.0-SNAPSHOT.jar:2.2.0-SNAPSHOT]
              at org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.createPrimitiveTypeInfo(TypeInfoFactory.java:157) ~[hive-exec-2.2.0-SNAPSHOT.jar:2.2.0-SNAPSHOT]
              at org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.getPrimitiveTypeInfo(TypeInfoFactory.java:109) ~[hive-exec-2.2.0-SNAPSHOT.jar:2.2.0-SNAPSHOT]
              at org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory.getDecimalTypeInfo(TypeInfoFactory.java:175) ~[hive-exec-2.2.0-SNAPSHOT.jar:2.2.0-SNAPSHOT]
              at org.apache.hadoop.hive.ql.optimizer.calcite.translator.ExprNodeConverter.visitLiteral(ExprNodeConverter.java:259) ~[hive-exec-2.2.0-SNAPSHOT.jar:2.2.0-SNAPSHOT]
              at org.apache.hadoop.hive.ql.optimizer.calcite.translator.ExprNodeConverter.visitLiteral(ExprNodeConverter.java:82) ~[hive-exec-2.2.0-SNAPSHOT.jar:2.2.0-SNAPSHOT]
              at org.apache.calcite.rex.RexLiteral.accept(RexLiteral.java:657) ~[calcite-core-1.6.0.jar:1.6.0]
              at org.apache.hadoop.hive.ql.optimizer.calcite.translator.ExprNodeConverter.visitCall(ExprNodeConverter.java:144) ~[hive-exec-2.2.0-SNAPSHOT.jar:2.2.0-SNAPSHOT]
              at org.apache.hadoop.hive.ql.optimizer.calcite.translator.ExprNodeConverter.visitCall(ExprNodeConverter.java:82) ~[hive-exec-2.2.0-SNAPSHOT.jar:2.2.0-SNAPSHOT]
              at org.apache.calcite.rex.RexCall.accept(RexCall.java:108) ~[calcite-core-1.6.0.jar:1.6.0]
              at org.apache.hadoop.hive.ql.optimizer.calcite.HiveRexExecutorImpl.reduce(HiveRexExecutorImpl.java:58) ~[hive-exec-2.2.0-SNAPSHOT.jar:2.2.0-SNAPSHOT]
              at org.apache.hadoop.hive.ql.optimizer.calcite.rules.HiveReduceExpressionsRule.reduceExpressionsInternal(HiveReduceExpressionsRule.java:376) ~[hive-exec-2.2.0-SNAPSHOT.jar:2.2.0-SNAPSHOT]
              at org.apache.hadoop.hive.ql.optimizer.calcite.rules.HiveReduceExpressionsRule.reduceExpressions(HiveReduceExpressionsRule.java:286) ~[hive-exec-2.2.0-SNAPSHOT.jar:2.2.0-SNAPSHOT] 
              at org.apache.hadoop.hive.ql.optimizer.calcite.rules.HiveReduceExpressionsRule$FilterReduceExpressionsRule.onMatch(HiveReduceExpressionsRule.java:141) ~[hive-exec-2.2.0-SNAPSHOT.jar:2.2.0-SNAPSHOT]
              at org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:318) ~[calcite-core-1.6.0.jar:1.6.0]
              at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:514) ~[calcite-core-1.6.0.jar:1.6.0]
              at org.apache.calcite.plan.hep.HepPlanner.applyRules(HepPlanner.java:392) ~[calcite-core-1.6.0.jar:1.6.0]
              at org.apache.calcite.plan.hep.HepPlanner.executeInstruction(HepPlanner.java:285) ~[calcite-core-1.6.0.jar:1.6.0]
              at org.apache.calcite.plan.hep.HepInstruction$RuleCollection.execute(HepInstruction.java:72) ~[calcite-core-1.6.0.jar:1.6.0]
              at org.apache.calcite.plan.hep.HepPlanner.executeProgram(HepPlanner.java:207) ~[calcite-core-1.6.0.jar:1.6.0]
              at org.apache.calcite.plan.hep.HepPlanner.findBestExp(HepPlanner.java:194) ~[calcite-core-1.6.0.jar:1.6.0]
              at org.apache.hadoop.hive.ql.parse.CalcitePlanner$CalcitePlannerAction.hepPlan(CalcitePlanner.java:1320) ~[hive-exec-2.2.0-SNAPSHOT.jar:2.2.0-SNAPSHOT]
              at org.apache.hadoop.hive.ql.parse.CalcitePlanner$CalcitePlannerAction.applyPreJoinOrderingTransforms(CalcitePlanner.java:1191) ~[hive-exec-2.2.0-SNAPSHOT.jar:2.2.0-SNAPSHOT]
              at org.apache.hadoop.hive.ql.parse.CalcitePlanner$CalcitePlannerAction.apply(CalcitePlanner.java:972) ~[hive-exec-2.2.0-SNAPSHOT.jar:2.2.0-SNAPSHOT]
      

      Attachments

        Issue Links

          Activity

            People

              jcamacho Jesús Camacho Rodríguez
              gopalv Gopal Vijayaraghavan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: