englefly commented on code in PR #11812:
URL: https://github.com/apache/doris/pull/11812#discussion_r949739790


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/MultiJoin.java:
##########
@@ -74,25 +93,30 @@ public Plan reorderJoinsAccordingToConditions() {
      */
     private Plan reorderJoinsAccordingToConditions(List<Plan> joinInputs, 
List<Expression> conjuncts) {
         if (joinInputs.size() == 2) {
-            Set<Slot> joinOutput = getJoinOutput(joinInputs.get(0), 
joinInputs.get(1));
-            Map<Boolean, List<Expression>> split = splitConjuncts(conjuncts, 
joinOutput);
-            List<Expression> joinConditions = split.get(true);
-            List<Expression> nonJoinConditions = split.get(false);
-
+            //Set<Slot> joinOutput = getJoinOutput(joinInputs.get(0), 
joinInputs.get(1));
+            //Map<Boolean, List<Expression>> split = splitConjuncts(conjuncts, 
joinOutput);
+            //List<Expression> joinConditions = split.get(true);
+            //List<Expression> nonJoinConditions = split.get(false);
+            Pair<List<Expression>, List<Expression>> pair = 
JoinUtils.extractExpressionForHashTable(
+                    
joinInputs.get(0).getOutput().stream().map(SlotReference.class::cast).collect(Collectors.toList()),
+                    
joinInputs.get(1).getOutput().stream().map(SlotReference.class::cast).collect(Collectors.toList()),
+                    conjuncts);
+            List<Expression> joinConditions = pair.first;
+            conjunctsKeepInFilter = pair.second;

Review Comment:
   At the end of multiJoin algorithm, there are only 2 status for predicates in 
`conjunctsForAllHashJoins`:
    - used to connect tables, they have been put to Join.hashJoinPredicates
    - unused, they are in the last recursive round of pair.second.
   
   By the algorithm, there is only one change to collect the unused predicates. 
That means before this line(105), `conjunctsKeepInFilter` is empty. So 
assignment is more efficient than addAll()



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to