zabetak commented on code in PR #4525:
URL: https://github.com/apache/calcite/pull/4525#discussion_r2333290067
##########
core/src/test/java/org/apache/calcite/rex/RexProgramTest.java:
##########
@@ -3559,6 +3582,30 @@ private static String getString(Map<RexNode, RexNode>
map) {
checkSimplify(or(eq(literal(10), vInt(0)), isNull(vInt(0))), expected);
}
+ @Test void testSimplifyOrIsNotDistinctFrom() {
+ RexNode aRef = input(tInt(true), 0);
+ RexLiteral l10 = literal(10);
+ RexLiteral l20 = literal(20);
+ RexLiteral l30 = literal(30);
+
+ checkSimplify(or(isNotDistinctFrom(aRef, l10), isNotDistinctFrom(aRef,
l20)),
+ "SEARCH($0, Sarg[10, 20; NULL AS FALSE])");
+ checkSimplify(or(isNotDistinctFrom(aRef, l10), isNotDistinctFrom(aRef,
l20), eq(aRef, l30)),
+ "SEARCH($0, Sarg[10, 20, 30])");
+ }
+
+ @Test void testSimplifyOrIsDistinctFrom() {
+ RexNode aRef = input(tInt(true), 0);
+ RexLiteral l10 = literal(10);
+ RexLiteral l20 = literal(20);
+ RexLiteral l30 = literal(30);
+
+ checkSimplify(or(isDistinctFrom(aRef, l10), isDistinctFrom(aRef, l20)),
+ "SEARCH($0, Sarg[TRUE])");
Review Comment:
Good idea. Fixed in
https://github.com/apache/calcite/pull/4525/commits/a57a0a53eae57295e09ca3f9ef8cd85ce848a684
##########
core/src/test/java/org/apache/calcite/rex/RexProgramTest.java:
##########
@@ -2113,6 +2113,29 @@ private void checkExponentialCnf(int n) {
checkSimplify(rexNode, "false");
}
+ @Test void testSimplifyAndIsDistinctFrom() {
Review Comment:
Fixed in
https://github.com/apache/calcite/pull/4525/commits/0f847ffcd4650a68390e584f54ec23e2307850f1
--
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]