sbroeder commented on code in PR #4959:
URL: https://github.com/apache/calcite/pull/4959#discussion_r3290316839
##########
core/src/main/java/org/apache/calcite/rex/RexCall.java:
##########
@@ -228,8 +228,13 @@ private boolean digestWithType() {
return operands.get(0).isAlwaysFalse();
case IS_NOT_FALSE:
case IS_TRUE:
- case CAST:
return operands.get(0).isAlwaysTrue();
+ case CAST:
Review Comment:
I don't believe it is a bug to call this function on non-boolean expressions
and there could be recursion in it related to casts from
`return operands.get(0).isAlwaysTrue();`
Consider the expression CAST(int_expr AS BOOLEAN) where int_expr is a
RexCall (eg. 1 + 1), then with the assertion it will fail, but with the early
return it works correctly.
I've added a new test to demonstrate this as well
testIsAlwaysTrueFalseCastNonBooleanCallToBoolean
--
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]