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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/TransposeSemiJoinLogicalJoinProject.java:
##########
@@ -65,7 +67,8 @@ public Rule build() {
                     if (containsType == ContainsType.ALL) {
                         return null;
                     }
-
+                    List<NamedExpression> topProjects = 
topSemiJoin.getOutput().stream()
+                            .map(slot -> (NamedExpression) 
slot).collect(Collectors.toList());

Review Comment:
   collect to ImmutableList to avoid another copy



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinCommute.java:
##########
@@ -59,7 +60,8 @@ public Rule build() {
                 .when(join -> check(swapType, join))
                 .whenNot(LogicalJoin::hasDistributeHint)
                 .whenNot(join -> joinOrderMatchBitmapRuntimeFilterOrder(join))
-                .whenNot(LogicalJoin::isMarkJoin)
+                .whenNot(join -> JoinUtils.isNullAwareMarkJoin(join))
+                .whenNot(join -> join.isMarkJoin() && 
join.getHashJoinConjuncts().isEmpty())

Review Comment:
   why cannot commute? add some comment?



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/PushDownProjectThroughSemiJoin.java:
##########
@@ -54,24 +55,36 @@ public class PushDownProjectThroughSemiJoin implements 
ExplorationRuleFactory {
     @Override
     public List<Rule> buildRules() {
         return ImmutableList.of(
-                
logicalJoin(logicalProject(logicalJoin().whenNot(LogicalJoin::isMarkJoin)), 
group())
+                logicalJoin(logicalProject(logicalJoin()), group())
                     .when(j -> 
j.left().child().getJoinType().isLeftSemiOrAntiJoin())
                     // Just pushdown project with non-column expr like (t.id + 
1)
                     .whenNot(j -> j.left().isAllSlots())
                     .whenNot(j -> j.left().child().hasDistributeHint())
                     .then(topJoin -> {
                         LogicalProject<LogicalJoin<GroupPlan, GroupPlan>> 
project = topJoin.left();
+                        Set<Slot> childOutput = project.child().getOutputSet();
+                        if (project.getOutput().stream()
+                                
.filter(MarkJoinSlotReference.class::isInstance)
+                                .anyMatch(slot -> childOutput.contains(slot))) 
{
+                            return null;
+                        }

Review Comment:
   is it equal to `whenNot(LogicalJoin::isMarkJoin))`? and 
`whenNot(LogicalJoin::isMarkJoin))` is more simplier?



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