morrySnow commented on code in PR #65110:
URL: https://github.com/apache/doris/pull/65110#discussion_r3557519694
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/ConvertOuterJoinToAntiJoin.java:
##########
@@ -128,4 +136,53 @@ private Plan toAntiJoin(LogicalFilter<LogicalJoin<Plan,
Plan>> filter, Map<ExprI
return filter.withChildren(newChild);
}
}
+
+ private Set<Slot> getNullRejectedJoinSlots(LogicalJoin<Plan, Plan> join) {
+ Set<Slot> leftOutputSet = join.left().getOutputSet();
+ Set<Slot> rightOutputSet = join.right().getOutputSet();
+ Set<Slot> nullRejectedJoinSlots = new HashSet<>();
+ collectNullRejectedJoinSlots(join.getHashJoinConjuncts(),
leftOutputSet, rightOutputSet,
+ nullRejectedJoinSlots);
+ collectNullRejectedJoinSlots(join.getOtherJoinConjuncts(),
leftOutputSet, rightOutputSet,
+ nullRejectedJoinSlots);
+ return nullRejectedJoinSlots;
+ }
+
+ private void collectNullRejectedJoinSlots(List<Expression> conjuncts,
Set<Slot> leftOutputSet,
+ Set<Slot> rightOutputSet, Set<Slot> nullRejectedJoinSlots) {
+ for (Expression conjunct : conjuncts) {
+ if (!(conjunct instanceof ComparisonPredicate) || conjunct
instanceof NullSafeEqual) {
+ continue;
+ }
+ ComparisonPredicate predicate = (ComparisonPredicate) conjunct;
+ if (isSlotComparisonBetweenChildren(predicate, leftOutputSet,
rightOutputSet)) {
+ nullRejectedJoinSlots.addAll(predicate.getInputSlots());
+ }
+ }
+ }
+
+ private Set<Slot> getAlwaysNullSlots(List<Slot> childOutput, List<Slot>
joinOutput, Set<Slot> alwaysNullSlots,
+ Set<Slot> nullRejectedJoinSlots) {
+ Set<Slot> result = new HashSet<>();
+ for (int i = 0; i < childOutput.size(); i++) {
+ Slot childSlot = childOutput.get(i);
+ Slot outputSlot = joinOutput.get(i);
+ if ((alwaysNullSlots.contains(childSlot) ||
alwaysNullSlots.contains(outputSlot))
Review Comment:
fixed
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]