asolimando commented on code in PR #3367:
URL: https://github.com/apache/calcite/pull/3367#discussion_r1311961669
##########
core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java:
##########
@@ -2699,6 +2699,33 @@ private void
checkPushJoinThroughUnionOnRightDoesNotMatchSemiOrAntiJoin(JoinRelT
.check();
}
+ /** Tests {@link org.apache.calcite.rel.rules.MinusToDistinctRule},
+ * which rewrites an {@link Minus} operator with 3 inputs. */
+ @Test void testMinusToDistinct() {
+ final String sql = "select EMPNO,ENAME,JOB from emp where deptno = 10\n"
+ + "except\n"
+ + "select EMPNO,ENAME,JOB from emp where deptno = 20\n"
+ + "except\n"
+ + "select EMPNO,ENAME,JOB from emp where deptno = 30\n";
+ sql(sql)
+ .withRule(CoreRules.MINUS_MERGE, CoreRules.MINUS_TO_DISTINCT,
CoreRules.PROJECT_MERGE)
+ .check();
+ }
+
+ /** Tests {@link org.apache.calcite.rel.rules.MinusToDistinctRule},
+ * correctly ignores an {@code EXCEPT ALL}. It can only handle
+ * {@code EXCEPT DISTINCT}. */
+ @Test void testMinusToDistinctAll() {
Review Comment:
This test covers `A except B except all C`, can you also add a test covering
`A except all B except C`?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]