calcite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jh...@apache.org
Subject [1/5] calcite git commit: [CALCITE-1158] Make AggregateRemoveRule extensible
Date Tue, 22 Mar 2016 01:24:40 GMT
Repository: calcite
Updated Branches:
  refs/heads/master 0ad58ed62 -> cfd2071a4


[CALCITE-1158] Make AggregateRemoveRule extensible

Close apache/calcite#212


Project: http://git-wip-us.apache.org/repos/asf/calcite/repo
Commit: http://git-wip-us.apache.org/repos/asf/calcite/commit/68a17fc9
Tree: http://git-wip-us.apache.org/repos/asf/calcite/tree/68a17fc9
Diff: http://git-wip-us.apache.org/repos/asf/calcite/diff/68a17fc9

Branch: refs/heads/master
Commit: 68a17fc91bcec738907e980c9ea3f97e44e875cf
Parents: 0ad58ed
Author: Jesus Camacho Rodriguez <jcamacho@apache.org>
Authored: Wed Mar 16 13:13:32 2016 +0100
Committer: Julian Hyde <jhyde@apache.org>
Committed: Thu Mar 17 15:15:54 2016 -0700

----------------------------------------------------------------------
 .../apache/calcite/rel/rules/AggregateRemoveRule.java    | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/68a17fc9/core/src/main/java/org/apache/calcite/rel/rules/AggregateRemoveRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/rules/AggregateRemoveRule.java b/core/src/main/java/org/apache/calcite/rel/rules/AggregateRemoveRule.java
index b98ba64..9a21613 100644
--- a/core/src/main/java/org/apache/calcite/rel/rules/AggregateRemoveRule.java
+++ b/core/src/main/java/org/apache/calcite/rel/rules/AggregateRemoveRule.java
@@ -19,6 +19,7 @@ package org.apache.calcite.rel.rules;
 import org.apache.calcite.plan.RelOptRule;
 import org.apache.calcite.plan.RelOptRuleCall;
 import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.core.Aggregate;
 import org.apache.calcite.rel.logical.LogicalAggregate;
 import org.apache.calcite.rel.metadata.RelMetadataQuery;
 import org.apache.calcite.runtime.SqlFunctions;
@@ -26,21 +27,21 @@ import org.apache.calcite.tools.RelBuilder;
 
 /**
  * Planner rule that removes
- * a {@link org.apache.calcite.rel.logical.LogicalAggregate}
+ * a {@link org.apache.calcite.rel.core.Aggregate}
  * if it computes no aggregate functions
  * (that is, it is implementing {@code SELECT DISTINCT})
  * and the underlying relational expression is already distinct.
  */
 public class AggregateRemoveRule extends RelOptRule {
   public static final AggregateRemoveRule INSTANCE =
-      new AggregateRemoveRule();
+      new AggregateRemoveRule(LogicalAggregate.class);
 
   //~ Constructors -----------------------------------------------------------
 
   /**
    * Creates a AggregateRemoveRule.
    */
-  private AggregateRemoveRule() {
+  public AggregateRemoveRule(Class<? extends Aggregate> aggregateClass) {
     // REVIEW jvs 14-Mar-2006: We have to explicitly mention the child here
     // to make sure the rule re-fires after the child changes (e.g. via
     // ProjectRemoveRule), since that may change our information
@@ -48,14 +49,14 @@ public class AggregateRemoveRule extends RelOptRule {
     // distinct to make it correct up-front, we can get rid of the reference
     // to the child here.
     super(
-        operand(LogicalAggregate.class,
+        operand(aggregateClass,
             operand(RelNode.class, any())));
   }
 
   //~ Methods ----------------------------------------------------------------
 
   public void onMatch(RelOptRuleCall call) {
-    final LogicalAggregate aggregate = call.rel(0);
+    final Aggregate aggregate = call.rel(0);
     final RelNode input = call.rel(1);
     if (!aggregate.getAggCallList().isEmpty() || aggregate.indicator) {
       return;


Mime
View raw message