You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2015/11/13 16:37:00 UTC

hive git commit: HIVE-11955 : Add costing for join-groupby transpose rule (Ashutosh Chauhan via Jesus Camacho Rodriguez)

Repository: hive
Updated Branches:
  refs/heads/master d2fd0060e -> 0804ddb5c


HIVE-11955 : Add costing for join-groupby transpose rule (Ashutosh Chauhan via Jesus Camacho Rodriguez)

Signed-off-by: Ashutosh Chauhan <ha...@apache.org>


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

Branch: refs/heads/master
Commit: 0804ddb5c63d43187c30e86af4b90f8ad86dc1d0
Parents: d2fd006
Author: Ashutosh Chauhan <ha...@apache.org>
Authored: Wed Nov 11 14:31:36 2015 -0800
Committer: Ashutosh Chauhan <ha...@apache.org>
Committed: Fri Nov 13 07:36:46 2015 -0800

----------------------------------------------------------------------
 .../calcite/rules/HiveAggregateJoinTransposeRule.java        | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/0804ddb5/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveAggregateJoinTransposeRule.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveAggregateJoinTransposeRule.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveAggregateJoinTransposeRule.java
index 211b6fa..c59af39 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveAggregateJoinTransposeRule.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveAggregateJoinTransposeRule.java
@@ -296,6 +296,14 @@ public class HiveAggregateJoinTransposeRule extends AggregateJoinTransposeRule {
           Mappings.apply2(mapping, aggregate.getGroupSets()), newAggCalls);
     }
     call.transformTo(r);
+    // Add original tree as well for potential alternative transformation.
+    // This is modeled after LoptOptimizeJoinRule::findBestOrderings() in
+    // which rule adds multiple transformations and Planner picks the cheapest one.
+    // Hep planner will automatically pick the one with lower cost among two.
+    // For details, see: HepPlanner:applyTransformationResults()
+    // In this case, if ndv is close to # of rows, i.e., group by is not resulting
+    // in any deduction, doing this transformation is not useful.
+    call.transformTo(aggregate);
   }
 
   /** Computes the closure of a set of columns according to a given list of