mihaibudiu commented on code in PR #4646:
URL: https://github.com/apache/calcite/pull/4646#discussion_r2561972948
##########
core/src/main/java/org/apache/calcite/rex/RexSimplify.java:
##########
@@ -1153,16 +1153,15 @@ private RexNode simplifyIs(RexCall call, RexUnknownAs
unknownAs) {
return rexBuilder.makeLiteral(true);
}
if (RexUtil.isLosslessCast(a)) {
- if (!a.getType().isNullable()) {
- return rexBuilder.makeLiteral(true);
- }
- return rexBuilder.makeCall(SqlStdOperatorTable.IS_NOT_NULL,
RexUtil.removeCast(a));
+ a = RexUtil.removeCast(a);
+ // to keep this simplification, we must return IS NOT NULL(a),
+ // even if we cannot do anything else
}
if (predicates.pulledUpPredicates.contains(a)) {
return rexBuilder.makeLiteral(true);
}
if (hasCustomNullabilityRules(a.getKind())) {
- return null;
+ return rexBuilder.makeCall(SqlStdOperatorTable.IS_NOT_NULL, a);
Review Comment:
ok, I will do it in a separate PR which will do this for more operators.
--
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]