morrySnow commented on code in PR #64898:
URL: https://github.com/apache/doris/pull/64898#discussion_r3518133037


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownJoinOtherCondition.java:
##########
@@ -86,7 +86,16 @@ && allCoveredBy(otherConjunct, join.left().getOutputSet())) {
                             leftConjuncts.add(otherConjunct);
                         } else if 
(PUSH_DOWN_RIGHT_VALID_TYPE.contains(join.getJoinType())
                                 && allCoveredBy(otherConjunct, 
join.right().getOutputSet())) {
-                            rightConjuncts.add(otherConjunct);
+                            // For NULL_AWARE_LEFT_ANTI_JOIN (NOT IN 
subquery), when hash join
+                            // conjuncts are empty (no correlation), pushing 
other conditions to
+                            // the right child would filter rows before the 
null-aware check,

Review Comment:
   **Suggestion:** Hoist the loop-invariant checks outside the `for` loop on 
line 77.
   
   `join.getJoinType().isNullAwareLeftAntiJoin()` and 
`join.getHashJoinConjuncts().isEmpty()` are both loop-invariant — they depend 
only on the join node, not on individual `otherConjunct` items. Computing them 
once before the loop and storing in a local boolean avoids N redundant method 
calls and makes the loop-invariant nature immediately obvious to readers.
   
   ```java
   // Before the loop:
   boolean isStandaloneNullAwareAntiJoin = 
join.getJoinType().isNullAwareLeftAntiJoin() 
       && join.getHashJoinConjuncts().isEmpty();
   ```



-- 
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]

Reply via email to