thomasrebele commented on code in PR #4505:
URL: https://github.com/apache/calcite/pull/4505#discussion_r2486180717
##########
core/src/main/java/org/apache/calcite/rex/RexSimplify.java:
##########
@@ -1028,9 +1037,25 @@ private RexNode simplifyIs(RexCall call, RexUnknownAs
unknownAs) {
switch (a.getKind()) {
case LITERAL:
return rexBuilder.makeLiteral(!((RexLiteral) a).isNull());
+ case DIVIDE: {
+ RexNode op0 = ((RexCall) a).getOperands().get(0);
+ RexNode op1 = ((RexCall) a).getOperands().get(1);
+ if (RexUtil.isNull(op0) || RexUtil.isNull(op1)) {
+ return rexBuilder.makeLiteral(false);
+ }
+ if (!op1.isA(SqlKind.LITERAL)) {
+ return rexBuilder.makeCall(
+ SqlStdOperatorTable.IS_NOT_NULL, simplifyGenericNode((RexCall)
a));
Review Comment:
Indeed, `a` should already be simplified. I vaguely remember that I arrived
at the makeCall with a not-simplified `a`. As I cannot reproduce it anymore,
I'll remove the call to `simplifyGenericNode`.
--
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]