Repository: calcite
Updated Branches:
  refs/heads/master 4b4d8037c -> 5f8c06f03


[CALCITE-2563] Materialized view rewriting may swap columns in equivalent 
classes incorrectly


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

Branch: refs/heads/master
Commit: 5f8c06f03be9bd9daa55a6c1e96d762423604bdd
Parents: 4b4d803
Author: Jesus Camacho Rodriguez <[email protected]>
Authored: Sun Sep 16 11:25:11 2018 -0700
Committer: Jesus Camacho Rodriguez <[email protected]>
Committed: Sun Sep 16 11:25:36 2018 -0700

----------------------------------------------------------------------
 .../apache/calcite/rel/rules/AbstractMaterializedViewRule.java  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/5f8c06f0/core/src/main/java/org/apache/calcite/rel/rules/AbstractMaterializedViewRule.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/calcite/rel/rules/AbstractMaterializedViewRule.java
 
b/core/src/main/java/org/apache/calcite/rel/rules/AbstractMaterializedViewRule.java
index 709b824..54da1e4 100644
--- 
a/core/src/main/java/org/apache/calcite/rel/rules/AbstractMaterializedViewRule.java
+++ 
b/core/src/main/java/org/apache/calcite/rel/rules/AbstractMaterializedViewRule.java
@@ -2541,8 +2541,9 @@ public abstract class AbstractMaterializedViewRule 
extends RelOptRule {
         // Both present, we need to merge
         if (c1.size() < c2.size()) {
           // We swap them to merge
-          c1 = c2;
-          p1 = p2;
+          Set<RexTableInputRef> c2Temp = c2;
+          c2 = c1;
+          c1 = c2Temp;
         }
         for (RexTableInputRef newRef : c2) {
           c1.add(newRef);

Reply via email to