XieJiann commented on code in PR #30774:
URL: https://github.com/apache/doris/pull/30774#discussion_r1477309414


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/util/JoinUtils.java:
##########
@@ -330,15 +331,17 @@ public static boolean canEliminateByFk(LogicalJoin<?, ?> 
join, Plan primaryPlan,
     }
 
     /**
-     * can this join be eliminated by its left child
+     * if canEliminateByLeft
      */
-    public static boolean canEliminateByLeft(LogicalJoin<?, ?> join, 
FunctionalDependencies rightFuncDeps) {
+    public static boolean canEliminateByLeft(LogicalJoin<?, ?> join, 
ImmutableSet<FdItem> fdItems) {
         if (join.getJoinType().isLeftOuterJoin()) {
             Pair<Set<Slot>, Set<Slot>> njHashKeys = 
join.extractNullRejectHashKeys();
             if (!join.getOtherJoinConjuncts().isEmpty() || njHashKeys == null) 
{
                 return false;
             }
-            return rightFuncDeps.isUnique(njHashKeys.second);
+            return fdItems.stream().anyMatch(e -> 
e.getParentExprs().containsAll(njHashKeys.second)
+                    && e.isUnique()
+                    && !e.isCandidate());

Review Comment:
   as stated above, the inferring of uniqueness is incomplete



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