hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1667391 - in /hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats: HiveRelMdCollation.java HiveRelMdDistribution.java
Date Tue, 17 Mar 2015 20:21:40 GMT
Author: hashutosh
Date: Tue Mar 17 20:21:39 2015
New Revision: 1667391

URL: http://svn.apache.org/r1667391
Log:
HIVE-9964 : CBO (Calcite Return Path): Traits propagation for Aggregate operator [CBO Branch]
(Jesus Camacho Rodriguez)

Modified:
    hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/HiveRelMdCollation.java
    hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/HiveRelMdDistribution.java

Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/HiveRelMdCollation.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/HiveRelMdCollation.java?rev=1667391&r1=1667390&r2=1667391&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/HiveRelMdCollation.java
(original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/HiveRelMdCollation.java
Tue Mar 17 20:21:39 2015
@@ -12,6 +12,7 @@ import org.apache.hadoop.hive.ql.optimiz
 import org.apache.hadoop.hive.ql.optimizer.calcite.HiveCalciteUtil.JoinLeafPredicateInfo;
 import org.apache.hadoop.hive.ql.optimizer.calcite.HiveCalciteUtil.JoinPredicateInfo;
 import org.apache.hadoop.hive.ql.optimizer.calcite.HiveRelCollation;
+import org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveAggregate;
 import org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveJoin;
 import org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveJoin.MapJoinStreamingRelation;
 
@@ -32,6 +33,20 @@ public class HiveRelMdCollation {
 
   //~ Methods ----------------------------------------------------------------
 
+  public ImmutableList<RelCollation> collations(HiveAggregate aggregate) {
+    // Compute collations
+    ImmutableList.Builder<RelFieldCollation> collationListBuilder =
+            new ImmutableList.Builder<RelFieldCollation>();
+    for (int pos : aggregate.getGroupSet().asList()) {
+      final RelFieldCollation fieldCollation = new RelFieldCollation(pos);
+      collationListBuilder.add(fieldCollation);
+    }
+    // Return aggregate collations
+    return ImmutableList.of(
+                RelCollationTraitDef.INSTANCE.canonize(
+                        new HiveRelCollation(collationListBuilder.build())));
+  }
+
   public ImmutableList<RelCollation> collations(HiveJoin join) {
     // Compute collations
     ImmutableList.Builder<RelFieldCollation> collationListBuilder =

Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/HiveRelMdDistribution.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/HiveRelMdDistribution.java?rev=1667391&r1=1667390&r2=1667391&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/HiveRelMdDistribution.java
(original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/HiveRelMdDistribution.java
Tue Mar 17 20:21:39 2015
@@ -10,6 +10,7 @@ import org.apache.hadoop.hive.ql.optimiz
 import org.apache.hadoop.hive.ql.optimizer.calcite.HiveCalciteUtil.JoinLeafPredicateInfo;
 import org.apache.hadoop.hive.ql.optimizer.calcite.HiveCalciteUtil.JoinPredicateInfo;
 import org.apache.hadoop.hive.ql.optimizer.calcite.HiveRelDistribution;
+import org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveAggregate;
 import org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveJoin;
 import org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveJoin.MapJoinStreamingRelation;
 
@@ -30,6 +31,11 @@ public class HiveRelMdDistribution {
 
   //~ Methods ----------------------------------------------------------------
 
+  public RelDistribution distribution(HiveAggregate aggregate) {
+    return new HiveRelDistribution(RelDistribution.Type.HASH_DISTRIBUTED,
+            aggregate.getGroupSet().asList());
+  }
+
   public RelDistribution distribution(HiveJoin join) {
     // Compute distribution
     ImmutableList.Builder<Integer> keysListBuilder =



Mime
View raw message