jackwener commented on code in PR #10479:
URL: https://github.com/apache/doris/pull/10479#discussion_r920962460


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinLAsscom.java:
##########
@@ -38,14 +50,101 @@ public class JoinLAsscom extends OneExplorationRuleFactory 
{
     @Override
     public Rule<Plan> build() {
         return innerLogicalJoin(innerLogicalJoin(), any()).then(topJoin -> {
+            if (!check(topJoin)) {
+                return null;
+            }
+
             LogicalJoin<GroupPlan, GroupPlan> bottomJoin = topJoin.left();
 
             GroupPlan a = bottomJoin.left();
             GroupPlan b = bottomJoin.right();
             Plan c = topJoin.right();
 
-            Plan newBottomJoin = new LogicalJoin(bottomJoin.getJoinType(), 
bottomJoin.getCondition(), a, c);
-            return new LogicalJoin(bottomJoin.getJoinType(), 
topJoin.getCondition(), newBottomJoin, b);
+            Optional<Expression> optTopJoinOnClause = topJoin.getCondition();
+            assert (optTopJoinOnClause.isPresent());
+            Expression topJoinOnClause = optTopJoinOnClause.get();
+            Optional<Expression> optBottomJoinOnClause = 
bottomJoin.getCondition();
+            // TODO: empty onClause.
+            assert (optBottomJoinOnClause.isPresent());
+            Expression bottomJoinOnClause = optBottomJoinOnClause.get();
+
+            List<SlotReference> aSlots = 
a.collect(SlotReference.class::isInstance);
+            List<SlotReference> bSlots = 
b.collect(SlotReference.class::isInstance);
+            List<SlotReference> cSlots = 
c.collect(SlotReference.class::isInstance);
+
+            // Check whether lhs and rhs (both are List<SlotReference>>) are 
intersecting.
+            BiPredicate<List<SlotReference>, List<SlotReference>> 
isIntersecting = (lhs, rhs) -> {
+                for (SlotReference lSlot : lhs) {
+                    for (SlotReference rSlot : rhs) {
+                        // TODO: tmp judge intersecting
+                        if (lSlot.getExprId() != rSlot.getExprId()) {
+                            return false;

Review Comment:
   It should be `==` instead of `!=`👍



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