herunkang2018 commented on code in PR #3279:
URL: https://github.com/apache/calcite/pull/3279#discussion_r1248371250
##########
core/src/main/java/org/apache/calcite/plan/RelOptPredicateList.java:
##########
@@ -236,14 +236,18 @@ public boolean isEffectivelyNotNull(RexNode e) {
}
}
if (SqlKind.COMPARISON.contains(e.getKind())) {
- // A comparison with a (non-null) literal, such as 'ref < 10', is not
null if 'ref'
- // is not null.
+ // A comparison with a (non-null) literal, such as 'ref < 10', or '10 <
ref',
+ // is not null if 'ref' is not null.
List<RexNode> operands = ((RexCall) e).getOperands();
// We can have just one operand in case e.g. of a RexSubQuery with IN
operator.
if (operands.size() > 1 && operands.get(1) instanceof RexLiteral
&& !((RexLiteral) operands.get(1)).isNull()) {
return isEffectivelyNotNull(operands.get(0));
}
+ if (operands.size() > 1 && operands.get(0) instanceof RexLiteral
+ && !((RexLiteral) operands.get(0)).isNull()) {
+ return isEffectivelyNotNull(operands.get(1));
+ }
Review Comment:
@kgyrtkirk Thanks for your advice. The refactor logic is more genaral, to
covers more case like `x < y is not true`. I will refactor it soon.
--
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]