This is an automated email from the ASF dual-hosted git repository.
hyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git
The following commit(s) were added to refs/heads/master by this push:
new 7650466 Remove duplicate method equalsSansConvention()
7650466 is described below
commit 7650466bc8de345d567e7a26f0cc4e43411bfbf8
Author: Haisheng Yuan <[email protected]>
AuthorDate: Fri Jul 17 22:53:00 2020 -0500
Remove duplicate method equalsSansConvention()
---
.../java/org/apache/calcite/plan/RelTraitSet.java | 3 +++
.../calcite/plan/volcano/TopDownRuleDriver.java | 25 ++--------------------
2 files changed, 5 insertions(+), 23 deletions(-)
diff --git a/core/src/main/java/org/apache/calcite/plan/RelTraitSet.java
b/core/src/main/java/org/apache/calcite/plan/RelTraitSet.java
index 22c59b1..3902b58 100644
--- a/core/src/main/java/org/apache/calcite/plan/RelTraitSet.java
+++ b/core/src/main/java/org/apache/calcite/plan/RelTraitSet.java
@@ -304,6 +304,9 @@ public final class RelTraitSet extends
AbstractList<RelTrait> {
if (this == other) {
return true;
}
+ if (this.size() != other.size()) {
+ return false;
+ }
for (int i = 0; i < traits.length; i++) {
if (traits[i].getTraitDef() == ConventionTraitDef.INSTANCE) {
continue;
diff --git
a/core/src/main/java/org/apache/calcite/plan/volcano/TopDownRuleDriver.java
b/core/src/main/java/org/apache/calcite/plan/volcano/TopDownRuleDriver.java
index c85c8e1..f67f133 100644
--- a/core/src/main/java/org/apache/calcite/plan/volcano/TopDownRuleDriver.java
+++ b/core/src/main/java/org/apache/calcite/plan/volcano/TopDownRuleDriver.java
@@ -16,10 +16,8 @@
*/
package org.apache.calcite.plan.volcano;
-import org.apache.calcite.plan.ConventionTraitDef;
import org.apache.calcite.plan.DeriveMode;
import org.apache.calcite.plan.RelOptCost;
-import org.apache.calcite.plan.RelTrait;
import org.apache.calcite.plan.RelTraitSet;
import org.apache.calcite.rel.PhysicalNode;
import org.apache.calcite.rel.RelNode;
@@ -854,8 +852,8 @@ class TopDownRuleDriver implements RuleDriver {
final int numSubset = input.set.subsets.size();
for (int j = 0; j < numSubset; j++) {
RelSubset subset = input.set.subsets.get(j);
- if (!subset.isDelivered() || equalsSansConvention(
- subset.getTraitSet(), rel.getCluster().traitSet())) {
+ if (!subset.isDelivered() || subset.getTraitSet()
+ .equalsSansConvention(rel.getCluster().traitSet())) {
// Ideally we should stop deriving new relnodes when the
// subset's traitSet equals with input traitSet, but
// in case someone manually builds a physical relnode
@@ -933,25 +931,6 @@ class TopDownRuleDriver implements RuleDriver {
}
}
-
- /**
- * Returns whether the 2 traitSets are equal without Convention.
- * It assumes they have the same traitDefs order.
- */
- private boolean equalsSansConvention(RelTraitSet ts1, RelTraitSet ts2) {
- assert ts1.size() == ts2.size();
- for (int i = 0; i < ts1.size(); i++) {
- RelTrait trait = ts1.getTrait(i);
- if (trait.getTraitDef() == ConventionTraitDef.INSTANCE) {
- continue;
- }
- if (!trait.equals(ts2.getTrait(i))) {
- return false;
- }
- }
- return true;
- }
-
@Override public void describe(TaskDescriptor desc) {
desc.item("mExpr", mExpr).item("group", group);
}