You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "NobiGo (via GitHub)" <gi...@apache.org> on 2023/06/27 02:46:56 UTC

[GitHub] [calcite] NobiGo commented on a diff in pull request #3279: [CALCITE-5798] '(1 < x) IS NOT TRUE' when x is not nullable should be simplified to '1 >= x'

NobiGo commented on code in PR #3279:
URL: https://github.com/apache/calcite/pull/3279#discussion_r1243074743


##########
core/src/test/java/org/apache/calcite/rex/RexProgramTest.java:
##########
@@ -2010,6 +2010,20 @@ private void checkExponentialCnf(int n) {
         ">(?0.int0, 0)");
   }
 
+  /** Unit test for
+   * <a href="https://issues.apache.org/jira/browse/CALCITE-5798">[CALCITE-5798]
+   * '(1 < x) IS NOT TRUE' when x is not nullable should be simplified to '1 >= x'</a>. */
+  @Test void testSimplifyInverseComparisonWithIsNotNullPredicate() {
+    final RexNode ref = input(tInt(true), 0);
+    RelOptPredicateList relOptPredicateList =
+        RelOptPredicateList.of(rexBuilder,
+            ImmutableList.of(isNotNull(ref)));
+    checkSimplifyFilter(
+        isNotTrue(gt(literal(1), ref)),

Review Comment:
   Looks like the test is the opposite. The summary is '(1 < x) IS NOT TRUE-->1>=x' but the test is '(1>x) IS NOT TRUE-->1<=x'. The test result is good. Just I think we should stay the same logic.



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org