danny0405 commented on a change in pull request #1116: [CALCITE-2929]
Simplification of IS NULL checks are incorrectly assum…
URL: https://github.com/apache/calcite/pull/1116#discussion_r267161945
##########
File path: core/src/main/java/org/apache/calcite/rex/RexSimplify.java
##########
@@ -708,12 +708,15 @@ private RexNode simplifyIs2(SqlKind kind, RexNode a,
RexUnknownAs unknownAs) {
}
private RexNode simplifyIsNotNull(RexNode a) {
- if (!a.getType().isNullable()) {
+ if (!a.getType().isNullable() && isSafeExpression(a)) {
return rexBuilder.makeLiteral(true);
}
if (predicates.pulledUpPredicates.contains(a)) {
return rexBuilder.makeLiteral(true);
}
+ if (a.getKind() == SqlKind.CAST) {
+ return null;
+ }
Review comment:
+1, that makes sense.
----------------------------------------------------------------
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]
With regards,
Apache Git Services