github-actions[bot] commented on code in PR #65982:
URL: https://github.com/apache/doris/pull/65982#discussion_r3642737265


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalJoin.java:
##########
@@ -704,11 +704,32 @@ public void computeEqualSet(Builder builder) {
 
     @Override
     public void computeFd(Builder builder) {
-        if (!joinType.isLeftSemiOrAntiJoin()) {
-            builder.addFuncDepsDG(right().getLogicalProperties().getTrait());
-        }
-        if (!joinType.isRightSemiOrAntiJoin()) {
-            builder.addFuncDepsDG(left().getLogicalProperties().getTrait());
+        switch (joinType) {
+            case INNER_JOIN:
+            case ASOF_LEFT_INNER_JOIN:
+            case ASOF_RIGHT_INNER_JOIN:
+            case CROSS_JOIN:
+                
builder.addFuncDepsDG(left().getLogicalProperties().getTrait());
+                
builder.addFuncDepsDG(right().getLogicalProperties().getTrait());
+                break;
+            case LEFT_SEMI_JOIN:
+            case LEFT_ANTI_JOIN:
+            case NULL_AWARE_LEFT_ANTI_JOIN:
+            case LEFT_OUTER_JOIN:
+            case ASOF_LEFT_OUTER_JOIN:
+                
builder.addFuncDepsDG(left().getLogicalProperties().getTrait());
+                break;
+            case RIGHT_SEMI_JOIN:
+            case RIGHT_ANTI_JOIN:

Review Comment:
   [P2] Preserve FDs with an originally non-null determinant
   
   This drops the nullable child's whole FD graph, including edges that remain 
valid after null extension. In the new test, `t2.id` is `NOT NULL` and unique, 
so `t2.id -> t2.id2`: matched rows always have a non-null `id`, while every 
unmatched row contributes `(id,id2)=(NULL,NULL)`. Those cases cannot collide, 
yet this arm discards the edge and makes `EliminateGroupByKey` retain `GROUP BY 
t2.id,t2.id2` (and likewise prevents redundant order-key elimination).
   
   The actual unsafe shape needs a nullable determinant, e.g. a matched 
`(a=NULL, coalesce(a,1)=1)` plus an unmatched `(NULL,NULL)`. Please filter 
nullable-side edges based on whether their determinant can be all-null in an 
original child row, keep the current NOT NULL-key dependency, and test that 
nullable collision; the mirrored physical recomputation path should be covered 
as well.



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