xuzifu666 commented on code in PR #5045:
URL: https://github.com/apache/calcite/pull/5045#discussion_r3464418556


##########
core/src/test/java/org/apache/calcite/rex/RexProgramTest.java:
##########
@@ -3841,6 +3841,33 @@ private static String getString(Map<RexNode, RexNode> 
map) {
     assertThat(result2.getOperands().get(0), is(booleanInput));
   }
 
+  /** Test cases for <a 
href="https://issues.apache.org/jira/browse/CALCITE-7619";>[CALCITE-7619]
+   * RexSimplify incorrectly simplifies IS_FALSE(x) when x is nullable</a>. */
+  @Test void testSimplifyPreservingTypeIsNotNullCast() {
+    // IS_FALSE(nullable_bool) has type BOOLEAN NOT NULL.
+    final RexNode isFalseExpr = isFalse(vBool());

Review Comment:
   Should we add a non-boolean regression test case?



##########
core/src/main/java/org/apache/calcite/rex/RexSimplify.java:
##########
@@ -200,6 +200,14 @@ public RexNode simplifyPreservingType(RexNode e, 
RexUnknownAs unknownAs,
         && SqlTypeUtil.equalSansNullability(rexBuilder.typeFactory, 
e2.getType(), e.getType())) {
       return e2;
     }
+    // If simplification widens nullability (NOT NULL → nullable) without 
changing

Review Comment:
   Should the comments specify that the new branch only takes effect when 
matchNullability=true?



-- 
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]

Reply via email to