chunweilei commented on code in PR #3143:
URL: https://github.com/apache/calcite/pull/3143#discussion_r1175963078
##########
core/src/main/java/org/apache/calcite/rex/RexSimplify.java:
##########
@@ -1793,16 +1761,53 @@ private <C extends Comparable<C>> RexNode
simplifyAnd2ForUnknownAsFalse(
return rexBuilder.makeLiteral(false);
}
}
- // Add the NOT disjunctions back in.
- for (RexNode notDisjunction : notTerms) {
- terms.add(not(notDisjunction));
- }
// The negated terms: only deterministic expressions
for (RexNode negatedTerm : negatedTerms) {
if (termsSet.contains(negatedTerm)) {
return rexBuilder.makeLiteral(false);
}
}
+ // Add the NOT disjunctions back in.
+ for (RexNode notDisjunction : notTerms) {
+ terms.add(not(notDisjunction));
+ }
+ // Find operands that make will let whole expression evaluate to FALSE if
set to NULL
+ final Set<RexNode> strongOperands = new HashSet<>();
+ for (RexNode term : terms) {
+ if (!RexUtil.isDeterministic(term)) {
+ continue;
+ }
+ final VariableCollector collector = new VariableCollector();
+ term.accept(collector);
+ for (RexInputRef ref : collector.refs) {
+ final boolean strong = Strong.isNotTrue(term,
ImmutableBitSet.of(ref.index));
+ if (strong) {
+ strongOperands.add(ref);
Review Comment:
Got it! Feel free to move forward.
--
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]