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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/SubqueryToApply.java:
##########
@@ -322,7 +338,8 @@ private ImmutableList<RelatedInfo> 
collectRelatedInfo(List<Expression> subqueryC
     private LogicalPlan subqueryToApply(List<SubqueryExpr> subqueryExprs, 
LogicalPlan childPlan,
                                         Map<SubqueryExpr, 
Optional<MarkJoinSlotReference>> subqueryToMarkJoinSlot,
                                         CascadesContext ctx,
-                                        Optional<Expression> conjunct, boolean 
isProject) {
+                                        Optional<Expression> conjunct, boolean 
isProject,
+                                        boolean isMarkJoinSlotNotNull) {

Review Comment:
   add more comment to explain the effect of isMarkJoinSlotNotNull



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalApply.java:
##########
@@ -62,13 +62,16 @@ public class LogicalApply<LEFT_CHILD_TYPE extends Plan, 
RIGHT_CHILD_TYPE extends
     // Whether adding the subquery's output to projects
     private final boolean needAddSubOutputToProjects;
 
+    private final boolean isMarkJoinSlotNotNull;

Review Comment:
   explain it



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java:
##########
@@ -1270,7 +1292,7 @@ public PlanFragment visitPhysicalHashJoin(
         List<SlotDescriptor> rightIntermediateSlotDescriptor = 
Lists.newArrayList();
         TupleDescriptor intermediateDescriptor = context.generateTupleDesc();
 
-        if (hashJoin.getOtherJoinConjuncts().isEmpty()
+        if (hashJoin.getOtherJoinConjuncts().isEmpty() && 
(isHashJoinConjunctsEmpty ^ isMarkJoinConjunctsEmpty)

Review Comment:
   ```suggestion
           if (hashJoin.getOtherJoinConjuncts().isEmpty() && 
(isHashJoinConjunctsEmpty != isMarkJoinConjunctsEmpty)
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/UsingJoin.java:
##########
@@ -47,6 +46,7 @@ public class UsingJoin<LEFT_CHILD_TYPE extends Plan, 
RIGHT_CHILD_TYPE extends Pl
     private final JoinType joinType;
     private final ImmutableList<Expression> otherJoinConjuncts;
     private final ImmutableList<Expression> hashJoinConjuncts;
+    private final ImmutableList<Expression> markJoinConjuncts;

Review Comment:
   why update UsingJoin? it could not be mark join at all



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/SubqueryToApply.java:
##########
@@ -216,12 +226,18 @@ public List<Rule> buildRules() {
                         ReplaceSubquery replaceSubquery = new 
ReplaceSubquery(ctx.statementContext, true);
                         SubqueryContext context = new 
SubqueryContext(subqueryExprs);
                         Expression conjunct = 
replaceSubquery.replace(subqueryConjuncts.get(i), context);
-
+                        boolean isMarkSlotNotNull = 
conjunct.containsType(MarkJoinSlotReference.class)
+                                        ? ExpressionUtils
+                                                .canInferNotNullForMarkSlot(
+                                                        
TrySimplifyPredicateWithMarkJoinSlot.INSTANCE
+                                                                
.rewrite(conjunct,
+                                                                        null))
+                                        : false;

Review Comment:
   nit: optimize the wrap



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