You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by ru...@apache.org on 2019/07/31 07:15:42 UTC

[calcite] branch master updated: [CALCITE-3211] List of MutableRel may fail to be identified by SubstitutionVisitor during matching. (Jin Xing)

This is an automated email from the ASF dual-hosted git repository.

rubenql 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 d98856b  [CALCITE-3211] List of MutableRel may fail to be identified by SubstitutionVisitor during matching. (Jin Xing)
d98856b is described below

commit d98856bf1a5f5c151d004b769e14bdd368a67234
Author: jinxing <ji...@gmail.com>
AuthorDate: Wed Jul 24 15:51:48 2019 +0800

    [CALCITE-3211] List of MutableRel may fail to be identified by SubstitutionVisitor during matching. (Jin Xing)
---
 .../main/java/org/apache/calcite/rel/mutable/MutableRels.java    | 4 +++-
 core/src/test/java/org/apache/calcite/test/MutableRelTest.java   | 9 +++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/core/src/main/java/org/apache/calcite/rel/mutable/MutableRels.java b/core/src/main/java/org/apache/calcite/rel/mutable/MutableRels.java
index 90c9678..44af834 100644
--- a/core/src/main/java/org/apache/calcite/rel/mutable/MutableRels.java
+++ b/core/src/main/java/org/apache/calcite/rel/mutable/MutableRels.java
@@ -62,6 +62,7 @@ import com.google.common.collect.Lists;
 import java.util.AbstractList;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /** Utilities for dealing with {@link MutableRel}s. */
 public abstract class MutableRels {
@@ -399,7 +400,8 @@ public abstract class MutableRels {
   }
 
   private static List<MutableRel> toMutables(List<RelNode> nodes) {
-    return Lists.transform(nodes, MutableRels::toMutable);
+    return nodes.stream().map(MutableRels::toMutable)
+        .collect(Collectors.toList());
   }
 }
 
diff --git a/core/src/test/java/org/apache/calcite/test/MutableRelTest.java b/core/src/test/java/org/apache/calcite/test/MutableRelTest.java
index 81b9d4b..3427a96 100644
--- a/core/src/test/java/org/apache/calcite/test/MutableRelTest.java
+++ b/core/src/test/java/org/apache/calcite/test/MutableRelTest.java
@@ -195,6 +195,15 @@ public class MutableRelTest {
     MatcherAssert.assertThat(actual, Matchers.isLinux(expected));
   }
 
+  @Test public void testParentInfoOfUnion() {
+    MutableRel mutableRel = createMutableRel(
+        "select sal from emp where deptno = 10"
+            + "union select sal from emp where ename like 'John%'");
+    for (MutableRel input: mutableRel.getInputs()) {
+      Assert.assertTrue(input.getParent() == mutableRel);
+    }
+  }
+
   /** Verifies that after conversion to and from a MutableRel, the new
    * RelNode remains identical to the original RelNode. */
   private static void checkConvertMutableRel(String rel, String sql) {