From bd4925bf32ae926bcadcfc9f2f0804617fa1c4fe Mon Sep 17 00:00:00 2001 From: Ashutosh Chauhan Date: Thu, 28 Jan 2016 13:06:46 -0800 Subject: [PATCH] HIVE-12956 : run CBO in tests with mapred.mode=strict --- .../java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java index cc9dc23..4989cfa 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java @@ -437,11 +437,9 @@ boolean canCBOHandleAst(ASTNode ast, QB qb, PreCboCtx cboCtx) { */ static String canHandleQbForCbo(QueryProperties queryProperties, HiveConf conf, boolean topLevelQB, boolean verbose, QB qb) { - boolean isInTest = conf.getBoolVar(ConfVars.HIVE_IN_TEST); - boolean isStrictTest = isInTest - && !conf.getVar(ConfVars.HIVEMAPREDMODE).equalsIgnoreCase("nonstrict"); + boolean isInTest = conf.getBoolVar(ConfVars.HIVE_IN_TEST);; - if (!isStrictTest + if (!isInTest && !queryProperties.hasClusterBy() && !queryProperties.hasDistributeBy() && !queryProperties.hasSortBy() && !queryProperties.hasPTF() && !queryProperties.usesScript() && !queryProperties.hasMultiDestQuery() && !queryProperties.hasLateralViews()) { @@ -452,7 +450,7 @@ static String canHandleQbForCbo(QueryProperties queryProperties, HiveConf conf, // Not ok to run CBO, build error message. String msg = ""; if (verbose) { - if (isStrictTest) + if (isInTest) msg += "is in test running in mode other than nonstrict; "; if (queryProperties.hasClusterBy()) msg += "has cluster by; "; @@ -1071,7 +1069,7 @@ private RelNode applyPreJoinOrderingTransforms(RelNode basePlan, RelMetadataProv perfLogger.PerfLogEnd(this.getClass().getName(), PerfLogger.OPTIMIZER, "Calcite: Prejoin ordering transformation, factor out common filter elements and separating deterministic vs non-deterministic UDF"); - // 3. Run exhaustive PPD, add not null filters, transitive inference, + // 3. Run exhaustive PPD, add not null filters, transitive inference, // constant propagation, constant folding perfLogger.PerfLogBegin(this.getClass().getName(), PerfLogger.OPTIMIZER); basePlan = hepPlan(basePlan, true, mdProvider, executorProvider, HepMatchOrder.BOTTOM_UP, -- 1.7.12.4 (Apple Git-37)