rubenada commented on code in PR #5184:
URL: https://github.com/apache/calcite/pull/5184#discussion_r3835921691
##########
core/src/test/java/org/apache/calcite/rex/RexProgramTest.java:
##########
@@ -3024,6 +3025,149 @@ trueLiteral, literal(1),
checkSimplifyUnchanged(div(cast(vVarchar(), tInt(false)), nullInt));
}
+ /**
+ * Test cases for <a
href="https://issues.apache.org/jira/browse/CALCITE-7722">[CALCITE-7722]
+ * RexSimplify IS [NOT] NULL on a safe operator with Strong policy ANY and
unsafe operands
+ * can be further simplified</a>.
+ */
+ @Test void testSimplifyIsNotNullDistributesAcrossStrongOpWithLossyCast() {
+ // "(CAST(?0.varchar0):INTEGER + 1) IS NOT NULL" ==> "IS NOT
NULL(CAST(?0.varchar0):INTEGER)"
+ // The outer PLUS is strong AND shallow-safe; distribution keeps the
Review Comment:
It means the `IS_NOT_NULL(expr)` is "distributed" among the operands of the
expression: `IS_NOT_NULL(operand0) AND .... IS_NOT_NULL(operandN)`
--
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]