hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1624432 - in /hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql: optimizer/optiq/HiveOptiqUtil.java parse/SemanticAnalyzer.java
Date Fri, 12 Sep 2014 00:43:29 GMT
Author: hashutosh
Date: Fri Sep 12 00:43:29 2014
New Revision: 1624432

URL: http://svn.apache.org/r1624432
Log:
HIVE-8066 : [CBO] Handle charset  (Ashutosh Chauhan via John Pullokkaran)

Modified:
    hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/HiveOptiqUtil.java
    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/optimizer/optiq/HiveOptiqUtil.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/HiveOptiqUtil.java?rev=1624432&r1=1624431&r2=1624432&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/HiveOptiqUtil.java
(original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/HiveOptiqUtil.java
Fri Sep 12 00:43:29 2014
@@ -27,6 +27,8 @@ import java.util.Set;
 import java.util.Map.Entry;
 
 import org.apache.hadoop.hive.ql.optimizer.optiq.reloperators.HiveJoinRel;
+import org.apache.hadoop.hive.ql.parse.ASTNode;
+import org.apache.hadoop.hive.ql.parse.HiveParser;
 import org.eigenbase.rel.RelFactories.ProjectFactory;
 import org.eigenbase.rel.RelNode;
 import org.eigenbase.relopt.RelOptUtil;
@@ -55,7 +57,7 @@ public class HiveOptiqUtil {
   /**
    * Get list of virtual columns from the given list of projections.
    * <p>
-   * 
+   *
    * @param exps
    *          list of rex nodes representing projections
    * @return List of Virtual Columns, will not be null.
@@ -72,6 +74,17 @@ public class HiveOptiqUtil {
     return vCols;
   }
 
+  public static boolean validateASTForCBO (ASTNode ast) {
+    String astTree = ast.toStringTree();
+    String [] tokens = {"TOK_CHARSETLITERAL"};
+    for (String token : tokens) {
+      if (astTree.contains(token)) {
+         return false;
+      }
+    }
+    return true;
+  }
+
   public static List<RexNode> getProjsFromBelowAsInputRef(final RelNode rel) {
     List<RexNode> projectList = Lists.transform(rel.getRowType().getFieldList(),
         new Function<RelDataTypeField, RexNode>() {
@@ -98,7 +111,7 @@ public class HiveOptiqUtil {
   /**
    * Push any equi join conditions that are not column references as Projections
    * on top of the children.
-   * 
+   *
    * @param factory
    *          Project factory to use.
    * @param inputRels
@@ -232,7 +245,7 @@ public class HiveOptiqUtil {
    * of equi join keys; the indexes are both in child and Join node schema.<br>
    * 3. Keeps a map of projection indexes that are part of join keys to list of
    * conjuctive elements(JoinLeafPredicateInfo) that uses them.
-   * 
+   *
    */
   public static class JoinPredicateInfo {
     private final ImmutableList<JoinLeafPredicateInfo>                        nonEquiJoinPredicateElements;

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=1624432&r1=1624431&r2=1624432&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 Fri
Sep 12 00:43:29 2014
@@ -9581,7 +9581,7 @@ public class SemanticAnalyzer extends Ba
           || ast.getToken().getType() == HiveParser.TOK_EXPLAIN;
       if (!tokenTypeIsQuery || createVwDesc != null
           || !HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVE_CBO_ENABLED)
-          || !canHandleQuery(qb, true)) {
+          || !canHandleQuery(qb, true) || !HiveOptiqUtil.validateASTForCBO(ast)) {
         runCBO = false;
       }
 
@@ -12351,7 +12351,7 @@ public class SemanticAnalyzer extends Ba
       HiveTableScanRel tableRel = null;
 
       try {
-        
+
         // 0. If the table has a Sample specified, bail from Optiq path.
         if ( qb.getParseInfo().getTabSample(tableAlias) != null ||
             SemanticAnalyzer.this.nameToSplitSample.containsKey(tableAlias)) {
@@ -12361,7 +12361,7 @@ public class SemanticAnalyzer extends Ba
           LOG.debug(msg);
           throw new OptiqSemanticException(msg);
         }
-        
+
         // 1. Get Table Alias
         String alias_id = getAliasId(tableAlias, qb);
 



Mime
View raw message