julianhyde commented on code in PR #5295:
URL: https://github.com/apache/calcite/pull/5295#discussion_r4116412685
##########
core/src/main/java/org/apache/calcite/rex/RexSimplify.java:
##########
@@ -2013,11 +2013,13 @@ private <C extends Comparable<C>> RexNode
simplifyAnd2ForUnknownAsFalse(
// Simplify BOOLEAN expressions if possible
while (term.getKind() == SqlKind.EQUALS) {
RexCall call = (RexCall) term;
- if (call.getOperands().get(0).isAlwaysTrue()) {
+ if (call.getOperands().get(0).isAlwaysTrue()
+ && call.getOperands().get(1).getType().getSqlTypeName() ==
SqlTypeName.BOOLEAN) {
Review Comment:
Ah, it's a malformed `=`, not a malformed boolean term in `AND` or `OR`.
That's not OK, but it's understandable. I think it would break a lot of clients
it Calcite started to reject such `=` calls.
So I think you should make `isAlwaysTrue` more defensive - push the 'type is
boolean' check into that method. Thus for the string literal 'true',
`isAlwaysTrue` will return false.
Ditto `isAlwaysFalse` and any analogous methods.
--
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]