hsyuan commented on a change in pull request #784: [CALCITE-2456] fix 
VolcanoRuleCall#match for unordered child operand
URL: https://github.com/apache/calcite/pull/784#discussion_r273260245
 
 

 ##########
 File path: core/src/test/java/org/apache/calcite/tools/PlannerTest.java
 ##########
 @@ -372,6 +376,148 @@ private void checkMetadataPredicates(String sql,
             + "  EnumerableTableScan(table=[[hr, emps]])\n"));
   }
 
+  /** Unit test that parses, validates, converts and plans. */
+  @Test public void trimEmptyUnion2() throws Exception {
+    checkUnionPruning("values(1) union all select * from (values(2)) where 
false",
+        "EnumerableValues(type=[RecordType(INTEGER EXPR$0)], tuples=[[{ 1 
}]])\n");
+
+    checkUnionPruning("select * from (values(2)) where false union all 
values(1)",
+        "EnumerableValues(type=[RecordType(INTEGER EXPR$0)], tuples=[[{ 1 
}]])\n");
+  }
+
+  @Test public void trimEmptyUnion31() throws Exception {
+    emptyUnions31();
+  }
+
+  @Test public void trimEmptyUnion31withUnionMerge() throws Exception {
+    emptyUnions31(UnionMergeRule.INSTANCE);
+  }
+
+  private void emptyUnions31(UnionMergeRule... extraRules)
+      throws SqlParseException, ValidationException, RelConversionException {
+    String plan = "EnumerableValues(type=[RecordType(INTEGER EXPR$0)], 
tuples=[[{ 1 }]])\n";
+    checkUnionPruning("values(1)"
+            + " union all select * from (values(2)) where false"
+            + " union all select * from (values(3)) where false",
+        plan, extraRules);
+
+    checkUnionPruning("select * from (values(2)) where false"
+            + " union all values(1)"
+            + " union all select * from (values(3)) where false",
+        plan, extraRules);
+
+    checkUnionPruning("select * from (values(2)) where false"
+            + " union all select * from (values(3)) where false"
+            + " union all values(1)",
+        plan, extraRules);
+  }
+
+  @Ignore("[CALCITE-2773] java.lang.AssertionError: rel"
 
 Review comment:
   Did you forget to import `Ignore`?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to