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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/util/JoinUtils.java:
##########
@@ -98,19 +213,20 @@ public static Pair<List<SlotReference>, 
List<SlotReference>> getOnClauseUsedSlot
 
         List<SlotReference> leftSlots = 
Utils.getOutputSlotReference(join.left());
         List<SlotReference> rightSlots = 
Utils.getOutputSlotReference(join.right());
-        List<EqualTo> equalToList = getEqualTo(join);
-
+        List<EqualTo> equalToList = join.getHashJoinPredicates().stream()
+                .map(e -> (EqualTo) e).collect(Collectors.toList());
+        JoinSlotCoverageChecker checker = new 
JoinSlotCoverageChecker(leftSlots, rightSlots);
         for (EqualTo equalTo : equalToList) {
             List<SlotReference> leftOnSlots = 
equalTo.left().collect(SlotReference.class::isInstance);
             List<SlotReference> rightOnSlots = 
equalTo.right().collect(SlotReference.class::isInstance);
 
-            if (new HashSet<>(leftSlots).containsAll(leftOnSlots)
-                    && new HashSet<>(rightSlots).containsAll(rightOnSlots)) {
+            if (checker.isCoveredByLeftSlots(leftOnSlots)
+                    && checker.isCoveredByRightSlots(rightOnSlots)) {
                 // TODO: need rethink about `.get(0)`
                 childSlots.first.add(leftOnSlots.get(0));

Review Comment:
   i think addAll is needed, and get(0) will lead to mistake.



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