Repository: hive Updated Branches: refs/heads/master c75167d6e -> c19efd684
HIVE-10800 : CBO (Calcite Return Path): Setup correct information if CBO succeeds (Jesus Camacho Rodriguez via Ashutosh Chauhan) Signed-off-by: Ashutosh Chauhan <hashut...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/c577e60d Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/c577e60d Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/c577e60d Branch: refs/heads/master Commit: c577e60d0343288bff599a80592417ba63228637 Parents: c75167d Author: Jesus Camacho Rodriguez <jcama...@apache.org> Authored: Fri May 22 07:39:00 2015 -0700 Committer: Ashutosh Chauhan <hashut...@apache.org> Committed: Mon May 25 23:19:26 2015 -0700 ---------------------------------------------------------------------- .../hadoop/hive/ql/parse/CalcitePlanner.java | 33 +++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/c577e60d/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java ---------------------------------------------------------------------- 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 4760a22..4b111e8 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 @@ -240,6 +240,9 @@ public class CalcitePlanner extends SemanticAnalyzer { try { if (this.conf.getBoolVar(HiveConf.ConfVars.HIVE_CBO_RETPATH_HIVEOP)) { sinkOp = getOptimizedHiveOPDag(); + LOG.info("CBO Succeeded; optimized logical plan."); + this.ctx.setCboInfo("Plan optimized by CBO."); + this.ctx.setCboSucceeded(true); } else { // 1. Gen Optimized AST ASTNode newAST = getOptimizedAST(); @@ -254,21 +257,21 @@ public class CalcitePlanner extends SemanticAnalyzer { setAST(newAST); newAST = reAnalyzeCtasAfterCbo(newAST); } - Phase1Ctx ctx_1 = initPhase1Ctx(); - if (!doPhase1(newAST, getQB(), ctx_1, null)) { - throw new RuntimeException("Couldn't do phase1 on CBO optimized query plan"); - } - // unfortunately making prunedPartitions immutable is not possible - // here with SemiJoins not all tables are costed in CBO, so their - // PartitionList is not evaluated until the run phase. - getMetaData(getQB()); - - disableJoinMerge = false; - sinkOp = genPlan(getQB()); - LOG.info("CBO Succeeded; optimized logical plan."); - this.ctx.setCboInfo("Plan optimized by CBO."); - this.ctx.setCboSucceeded(true); - LOG.debug(newAST.dump()); + Phase1Ctx ctx_1 = initPhase1Ctx(); + if (!doPhase1(newAST, getQB(), ctx_1, null)) { + throw new RuntimeException("Couldn't do phase1 on CBO optimized query plan"); + } + // unfortunately making prunedPartitions immutable is not possible + // here with SemiJoins not all tables are costed in CBO, so their + // PartitionList is not evaluated until the run phase. + getMetaData(getQB()); + + disableJoinMerge = false; + sinkOp = genPlan(getQB()); + LOG.info("CBO Succeeded; optimized logical plan."); + this.ctx.setCboInfo("Plan optimized by CBO."); + this.ctx.setCboSucceeded(true); + LOG.debug(newAST.dump()); } } catch (Exception e) { boolean isMissingStats = noColsMissingStats.get() > 0;