diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java index 07bd138..662456d 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java @@ -9581,6 +9581,7 @@ public void analyzeInternal(ASTNode ast) throws SemanticException { disableJoinMerge = true; sinkOp = genPlan(qb); + LOG.info("CBO Succeeded; optimized logical plan."); /* * Use non CBO Result Set Schema so as to preserve user specified names. @@ -9590,8 +9591,9 @@ public void analyzeInternal(ASTNode ast) throws SemanticException { * .getRowResolver(), true); */ } catch (Exception e) { - LOG.warn("CBO failed, skipping CBO. ", e); - throw new RuntimeException(e); + //TODO: Distinguish between exceptions that can be retried vs user errors + LOG.error("CBO failed, skipping CBO. ", e); + reAnalyzeAST = true; } finally { runCBO = false; disableJoinMerge = false; @@ -11764,7 +11766,6 @@ private boolean canHandleQuery() { if ((queryProperties.getJoinCount() < HiveConf.getIntVar(conf, HiveConf.ConfVars.HIVE_CBO_MAX_JOINS_SUPPORTED)) - && (queryProperties.getOuterJoinCount() == 0) && !queryProperties.hasClusterBy() && !queryProperties.hasDistributeBy() && !queryProperties.hasSortBy() @@ -11774,6 +11775,8 @@ private boolean canHandleQuery() { && !queryProperties.hasMultiDestQuery() && !queryProperties.hasFilterWithSubQuery()) { runOptiqPlanner = true; + } else { + LOG.info("Can not invoke CBO; query contains operators not supported for CBO."); } return runOptiqPlanner;