You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by jc...@apache.org on 2018/04/24 15:59:19 UTC
calcite git commit: [CALCITE-2277] Skip SemiJoin operator in
materialized view-based rewriting algorithm
Repository: calcite
Updated Branches:
refs/heads/master 26ce10f9d -> fd5dc8adf
[CALCITE-2277] Skip SemiJoin operator in materialized view-based rewriting algorithm
Project: http://git-wip-us.apache.org/repos/asf/calcite/repo
Commit: http://git-wip-us.apache.org/repos/asf/calcite/commit/fd5dc8ad
Tree: http://git-wip-us.apache.org/repos/asf/calcite/tree/fd5dc8ad
Diff: http://git-wip-us.apache.org/repos/asf/calcite/diff/fd5dc8ad
Branch: refs/heads/master
Commit: fd5dc8adf4bca6a4f0c631479985cbb2b43b47e4
Parents: 26ce10f
Author: Jesus Camacho Rodriguez <jc...@apache.org>
Authored: Tue Apr 24 08:51:33 2018 -0700
Committer: Jesus Camacho Rodriguez <jc...@apache.org>
Committed: Tue Apr 24 08:51:41 2018 -0700
----------------------------------------------------------------------
.../calcite/rel/rules/AbstractMaterializedViewRule.java | 4 +++-
.../java/org/apache/calcite/test/MaterializationTest.java | 9 +++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/calcite/blob/fd5dc8ad/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 9192ba1..f9dd2f4 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
@@ -39,6 +39,7 @@ import org.apache.calcite.rel.core.Join;
import org.apache.calcite.rel.core.JoinRelType;
import org.apache.calcite.rel.core.Project;
import org.apache.calcite.rel.core.RelFactories;
+import org.apache.calcite.rel.core.SemiJoin;
import org.apache.calcite.rel.core.TableScan;
import org.apache.calcite.rel.metadata.RelMetadataQuery;
import org.apache.calcite.rel.type.RelDataType;
@@ -1872,7 +1873,8 @@ public abstract class AbstractMaterializedViewRule extends RelOptRule {
if (!TableScan.class.isAssignableFrom(c)
&& !Project.class.isAssignableFrom(c)
&& !Filter.class.isAssignableFrom(c)
- && !Join.class.isAssignableFrom(c)) {
+ && (!Join.class.isAssignableFrom(c)
+ || SemiJoin.class.isAssignableFrom(c))) {
// Skip it
return false;
}
http://git-wip-us.apache.org/repos/asf/calcite/blob/fd5dc8ad/core/src/test/java/org/apache/calcite/test/MaterializationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/MaterializationTest.java b/core/src/test/java/org/apache/calcite/test/MaterializationTest.java
index 4ce0dc2..4f7905c 100644
--- a/core/src/test/java/org/apache/calcite/test/MaterializationTest.java
+++ b/core/src/test/java/org/apache/calcite/test/MaterializationTest.java
@@ -1810,6 +1810,15 @@ public class MaterializationTest {
"expr#5=[10], expr#6=[>($t0, $t5)], expr#7=[30], expr#8=[>=($t7, $t0)]"));
}
+ @Test public void testJoinMaterialization11() {
+ checkNoMaterialize(
+ "select \"empid\" from \"emps\"\n"
+ + "join \"depts\" using (\"deptno\")",
+ "select \"empid\" from \"emps\"\n"
+ + "where \"deptno\" in (select \"deptno\" from \"depts\")",
+ HR_FKUK_MODEL);
+ }
+
@Test public void testJoinMaterializationUKFK1() {
checkMaterialize(
"select \"a\".\"empid\" \"deptno\" from\n"