danny0405 commented on a change in pull request #2238:
URL: https://github.com/apache/calcite/pull/2238#discussion_r517831463
##########
File path: core/src/test/java/org/apache/calcite/rex/RexProgramTest.java
##########
@@ -1774,6 +1770,27 @@ private void checkExponentialCnf(int n) {
checkSimplify2(e, "SEARCH(?0.int0, Sarg[10])", "=(?0.int0, 10)");
}
+ @Test void testSimplifyInAnd() {
+ // deptno in (20, 10) and deptno = 10
+ // ==>
+ // deptno = 10
+ checkSimplify2(
+ and(
+ in(vInt(), literal(20), literal(10)),
+ eq(vInt(), literal(10))),
+ "SEARCH(?0.int0, Sarg[10])",
+ "=(?0.int0, 10)");
+
+ // deptno in (20, 10) and deptno = 30
+ // ==>
+ // false
+ checkSimplify(
+ and(
+ in(vInt(), literal(20), literal(10)),
+ eq(vInt(), literal(30))),
+ "false");
+ }
+
Review comment:
Thanks, i have updated the test case.
----------------------------------------------------------------
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]