libenchao commented on code in PR #2887:
URL: https://github.com/apache/calcite/pull/2887#discussion_r958463132
##########
core/src/main/java/org/apache/calcite/plan/Strong.java:
##########
@@ -151,12 +151,41 @@ public static boolean allStrong(List<RexNode> operands) {
/** Returns whether an expression is definitely not true. */
public boolean isNotTrue(RexNode node) {
+ return isPredicateNotTrue(node) || isNull(node);
Review Comment:
I'm still not sure why we cannot merge `isNotTrue` and `isPredicateNotTrue`
like below:
```
public boolean isNotTrue(RexNode node) {
switch (node.getKind()) {
//TODO Enrich with more possible cases?
case IS_NOT_NULL:
return isNull(((RexCall) node).getOperands().get(0));
case OR:
return allNotTrue(((RexCall) node).getOperands());
case AND:
return anyNotTrue(((RexCall) node).getOperands());
default:
return isNull(node);
}
}
/** Returns whether all expressions in a list are definitely not true. */
private boolean allNotTrue(List<RexNode> operands) {
for (RexNode operand : operands) {
if (!isNotTrue(operand)) {
return false;
}
}
return true;
}
/** Returns whether any expressions in a list are definitely not true. */
private boolean anyNotTrue(List<RexNode> operands) {
for (RexNode operand : operands) {
if (isNotTrue(operand)) {
return true;
}
}
return false;
}
```
--
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]