You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/10/11 05:42:20 UTC

[GitHub] [calcite] jinxing64 commented on a change in pull request #1493: [CALCITE-3396] Materialization matching succeeds when query and view …

jinxing64 commented on a change in pull request #1493: [CALCITE-3396] Materialization matching succeeds when query and view …
URL: https://github.com/apache/calcite/pull/1493#discussion_r333832980
 
 

 ##########
 File path: core/src/test/java/org/apache/calcite/test/MaterializationTest.java
 ##########
 @@ -2468,12 +2468,25 @@ private void checkSatisfiable(RexNode e, String s) {
     checkMaterialize(sql, sql);
   }
 
-  @Test public void testUnionToUnion() {
+  @Test public void testUnionToUnion0() {
     String sql0 = "select * from \"emps\" where \"empid\" < 300";
     String sql1 = "select * from \"emps\" where \"empid\" > 200";
     checkMaterialize(sql0 + " union all " + sql1, sql1 + " union all " + sql0);
   }
 
+  @Test public void testUnionToUnion1() {
+    String sql0 = "select * from \"emps\" where \"empid\" < 300";
+    String sql1 = "select * from \"emps\" where \"empid\" > 200";
+    checkMaterialize(sql0 + " union " + sql1, sql1 + " union " + sql0);
+  }
+
+  @Test public void testUnionToUnion2() {
+    String sql0 = "select * from \"emps\" where \"empid\" < 300";
+    String sql1 = "select * from \"emps\" where \"empid\" > 200";
+    checkNoMaterialize(sql0 + " union " + sql1, sql0 + " union all " + sql1,
+        HR_FKUK_MODEL);
+  }
+
 
 Review comment:
   Thanks  a lot, haisheng ~
   Yes, when MV is `union all` but query is `union`, we can also succeed the matching if compensate a `distinct agg` outside of MV for deduplication.
   But my current thinking is to keep the `UnionToUnionUnifyRule` simpler and don't bring in the deduplication logic. 
   How do you think ? Which one do you prefer ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services