You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by gu...@apache.org on 2014/09/09 04:39:05 UTC
svn commit: r1623615 -
/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
Author: gunther
Date: Tue Sep 9 02:39:05 2014
New Revision: 1623615
URL: http://svn.apache.org/r1623615
Log:
HIVE-8026: CBO: check for Grouping Sets, Cube and Rollup and bail to non cbo planning (Harish Butani via Gunther Hagleitner)
Modified:
hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java?rev=1623615&r1=1623614&r2=1623615&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java Tue Sep 9 02:39:05 2014
@@ -12837,6 +12837,29 @@ public class SemanticAnalyzer extends Ba
RelNode gbRel = null;
QBParseInfo qbp = getQBParseInfo(qb);
+ // 0. for GSets, Cube, Rollup, bail from Optiq path.
+ if (!qbp.getDestRollups().isEmpty()
+ || !qbp.getDestGroupingSets().isEmpty()
+ || !qbp.getDestCubes().isEmpty()) {
+ String gbyClause = null;
+ HashMap<String, ASTNode> gbysMap = qbp.getDestToGroupBy();
+ if (gbysMap.size() == 1) {
+ ASTNode gbyAST = gbysMap.entrySet().iterator().next().getValue();
+ gbyClause = SemanticAnalyzer.this.ctx.getTokenRewriteStream()
+ .toString(gbyAST.getTokenStartIndex(),
+ gbyAST.getTokenStopIndex());
+ gbyClause = "in '" + gbyClause + "'.";
+ } else {
+ gbyClause = ".";
+ }
+ String msg = String.format("Encountered Grouping Set/Cube/Rollup%s"
+ + " Currently we don't support Grouping Set/Cube/Rollup"
+ + " clauses in CBO," + " turn off cbo for these queries.",
+ gbyClause);
+ LOG.debug(msg);
+ throw new OptiqSemanticException(msg);
+ }
+
// 1. Gather GB Expressions (AST) (GB + Aggregations)
// NOTE: Multi Insert is not supported
String detsClauseName = qbp.getClauseNames().iterator().next();