hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jcama...@apache.org
Subject hive git commit: HIVE-11347: CBO: Calcite Operator To Hive Operator (Calcite Return Path): fix CTAS (Pengcheng Xiong, via Jesus Camacho Rodriguez)
Date Tue, 28 Jul 2015 08:04:43 GMT
Repository: hive
Updated Branches:
  refs/heads/master 8dcead4ea -> 65396f04f


HIVE-11347: CBO: Calcite Operator To Hive Operator (Calcite Return Path): fix CTAS (Pengcheng
Xiong, via Jesus Camacho Rodriguez)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/65396f04
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/65396f04
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/65396f04

Branch: refs/heads/master
Commit: 65396f04fec331bd6ec8227e864f2600f0f7e925
Parents: 8dcead4
Author: Pengcheng Xiong <pxiong@hortonworks.com>
Authored: Tue Jul 28 09:03:54 2015 +0100
Committer: Jesus Camacho Rodriguez <jcamacho@apache.org>
Committed: Tue Jul 28 09:03:54 2015 +0100

----------------------------------------------------------------------
 .../optimizer/calcite/translator/PlanModifierForASTConv.java   | 2 +-
 .../calcite/translator/PlanModifierForReturnPath.java          | 6 +++++-
 .../java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java   | 3 ++-
 3 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/65396f04/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/PlanModifierForASTConv.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/PlanModifierForASTConv.java
b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/PlanModifierForASTConv.java
index 5f6be9e..5cd3a06 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/PlanModifierForASTConv.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/PlanModifierForASTConv.java
@@ -169,7 +169,7 @@ public class PlanModifierForASTConv {
     }
   }
 
-  private static RelNode renameTopLevelSelectInResultSchema(final RelNode rootRel,
+  public static RelNode renameTopLevelSelectInResultSchema(final RelNode rootRel,
       Pair<RelNode, RelNode> topSelparentPair, List<FieldSchema> resultSchema)
       throws CalciteSemanticException {
     RelNode parentOforiginalProjRel = topSelparentPair.getKey();

http://git-wip-us.apache.org/repos/asf/hive/blob/65396f04/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/PlanModifierForReturnPath.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/PlanModifierForReturnPath.java
b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/PlanModifierForReturnPath.java
index 06cf69d..81cc474 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/PlanModifierForReturnPath.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/PlanModifierForReturnPath.java
@@ -28,12 +28,16 @@ import org.apache.hadoop.hive.ql.optimizer.calcite.HiveCalciteUtil;
 public class PlanModifierForReturnPath {
 
 
-  public static RelNode convertOpTree(RelNode rel, List<FieldSchema> resultSchema)
+  public static RelNode convertOpTree(RelNode rel, List<FieldSchema> resultSchema,
boolean isCTAS)
           throws CalciteSemanticException {
     RelNode newTopNode = rel;
 
     Pair<RelNode, RelNode> topSelparentPair = HiveCalciteUtil.getTopLevelSelect(newTopNode);
     PlanModifierUtil.fixTopOBSchema(newTopNode, topSelparentPair, resultSchema, false);
+    if (isCTAS) {
+      newTopNode = PlanModifierForASTConv.renameTopLevelSelectInResultSchema(newTopNode,
+          topSelparentPair, resultSchema);
+    }
 
     return newTopNode;
   }

http://git-wip-us.apache.org/repos/asf/hive/blob/65396f04/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 5b469e3..5cbc428 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
@@ -641,7 +641,8 @@ public class CalcitePlanner extends SemanticAnalyzer {
     }
 
     RelNode modifiedOptimizedOptiqPlan = PlanModifierForReturnPath.convertOpTree(
-            introduceProjectIfNeeded(optimizedOptiqPlan), topLevelFieldSchema);
+        introduceProjectIfNeeded(optimizedOptiqPlan), topLevelFieldSchema, this.getQB()
+            .getTableDesc() != null);
 
     LOG.debug("Translating the following plan:\n" + RelOptUtil.toString(modifiedOptimizedOptiqPlan));
     Operator<?> hiveRoot = new HiveOpConverter(this, conf, unparseTranslator, topOps,


Mime
View raw message