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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalApply.java:
##########
@@ -131,6 +131,8 @@ public Optional<Expression> getSubCorrespondingConjunct() {
     public List<Slot> computeOutput() {
         return ImmutableList.<Slot>builder()
                 .addAll(left().getOutput())
+                .addAll(markJoinSlotReference.isPresent()
+                    ? ImmutableList.of(markJoinSlotReference.get()) : 
ImmutableList.of())

Review Comment:
   i think if apply is project, we need to return right's output



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/ReorderJoin.java:
##########
@@ -76,28 +75,31 @@
 public class ReorderJoin extends OneRewriteRuleFactory {
     @Override
     public Rule build() {
-        return logicalFilter(subTree(LogicalJoin.class, 
LogicalFilter.class)).thenApply(ctx -> {
-            if 
(ctx.statementContext.getConnectContext().getSessionVariable().isDisableJoinReorder())
 {
-                return null;
-            }
-            LogicalFilter<Plan> filter = ctx.root;
-
-            Map<Plan, JoinHintTypeAndMarkJoinSlot> planToJoinMembers = 
Maps.newHashMap();
-            Plan plan = joinToMultiJoin(filter, planToJoinMembers);
-            Preconditions.checkState(plan instanceof MultiJoin);
-            MultiJoin multiJoin = (MultiJoin) plan;
-            
ctx.statementContext.setMaxNArayInnerJoin(multiJoin.children().size());
-            Plan after = multiJoinToJoin(multiJoin, planToJoinMembers);
-            return after;
-        }).toRule(RuleType.REORDER_JOIN);
+        return logicalFilter(subTree(LogicalJoin.class, LogicalFilter.class))
+            .whenNot(filter -> filter.child() instanceof LogicalJoin
+                    && ((LogicalJoin<?, ?>) filter.child()).isMarkJoin())

Review Comment:
   if the plan is
   ```
   Filter()
   +---Join(non mark join)
       +---Join(mark join)
   ```
   
   what will happen? we always has `Project` on the top of `Filter(Mark Join)`? 
right?



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/SubqueryToApply.java:
##########
@@ -157,6 +163,10 @@ private LogicalPlan subqueryToApply(List<SubqueryExpr> 
subqueryExprs, LogicalPla
         LogicalPlan tmpPlan = childPlan;
         for (int i = 0; i < subqueryExprs.size(); ++i) {
             SubqueryExpr subqueryExpr = subqueryExprs.get(i);
+            if (isNorMarkJoinExistsWithAgg(subqueryExpr, 
subqueryToMarkJoinSlot)) {

Review Comment:
   Nor ? is typo?



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