You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "englefly (via GitHub)" <gi...@apache.org> on 2023/04/01 05:39:39 UTC

[GitHub] [doris] englefly commented on a diff in pull request #18299: [fix](Nereids): fix JoinReorderContext in withXXX() of LogicalJoin.

englefly commented on code in PR #18299:
URL: https://github.com/apache/doris/pull/18299#discussion_r1155061151


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalJoin.java:
##########
@@ -242,74 +242,63 @@ public RIGHT_CHILD_TYPE right() {
     @Override
     public LogicalJoin<Plan, Plan> withChildren(List<Plan> children) {
         Preconditions.checkArgument(children.size() == 2);
-        return new LogicalJoin<>(joinType, hashJoinConjuncts, otherJoinConjuncts, hint,
-                markJoinSlotReference, children.get(0),
-                children.get(1), joinReorderContext);
+        return new LogicalJoin<>(joinType, hashJoinConjuncts, otherJoinConjuncts, hint, markJoinSlotReference,
+                Optional.empty(), Optional.empty(), children.get(0), children.get(1), joinReorderContext);
     }
 
     @Override
     public LogicalJoin<Plan, Plan> withGroupExpression(Optional<GroupExpression> groupExpression) {
-        LogicalJoin<Plan, Plan> newJoin = new LogicalJoin<>(joinType, hashJoinConjuncts, otherJoinConjuncts, hint,
-                markJoinSlotReference,
-                groupExpression, Optional.of(getLogicalProperties()), left(), right());
-        newJoin.getJoinReorderContext().copyFrom(this.getJoinReorderContext());
-        return newJoin;
+        return new LogicalJoin<>(joinType, hashJoinConjuncts, otherJoinConjuncts, hint, markJoinSlotReference,
+                groupExpression, Optional.of(getLogicalProperties()), left(), right(), joinReorderContext);
     }
 
     @Override
     public LogicalJoin<Plan, Plan> withLogicalProperties(Optional<LogicalProperties> logicalProperties) {
-        LogicalJoin<Plan, Plan> newJoin = new LogicalJoin<>(joinType, hashJoinConjuncts, otherJoinConjuncts, hint,
-                markJoinSlotReference,
-                Optional.empty(), logicalProperties, left(), right());
-        newJoin.getJoinReorderContext().copyFrom(this.getJoinReorderContext());
-        return newJoin;
+        return new LogicalJoin<>(joinType, hashJoinConjuncts, otherJoinConjuncts, hint, markJoinSlotReference,
+                Optional.empty(), logicalProperties, left(), right(), joinReorderContext);
+    }
+
+    public LogicalJoin withChildrenNoContext(Plan left, Plan right) {

Review Comment:
   do we still need withChildren() ?



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalJoin.java:
##########
@@ -242,74 +242,63 @@ public RIGHT_CHILD_TYPE right() {
     @Override
     public LogicalJoin<Plan, Plan> withChildren(List<Plan> children) {
         Preconditions.checkArgument(children.size() == 2);
-        return new LogicalJoin<>(joinType, hashJoinConjuncts, otherJoinConjuncts, hint,
-                markJoinSlotReference, children.get(0),
-                children.get(1), joinReorderContext);
+        return new LogicalJoin<>(joinType, hashJoinConjuncts, otherJoinConjuncts, hint, markJoinSlotReference,
+                Optional.empty(), Optional.empty(), children.get(0), children.get(1), joinReorderContext);
     }
 
     @Override
     public LogicalJoin<Plan, Plan> withGroupExpression(Optional<GroupExpression> groupExpression) {
-        LogicalJoin<Plan, Plan> newJoin = new LogicalJoin<>(joinType, hashJoinConjuncts, otherJoinConjuncts, hint,
-                markJoinSlotReference,
-                groupExpression, Optional.of(getLogicalProperties()), left(), right());
-        newJoin.getJoinReorderContext().copyFrom(this.getJoinReorderContext());
-        return newJoin;
+        return new LogicalJoin<>(joinType, hashJoinConjuncts, otherJoinConjuncts, hint, markJoinSlotReference,
+                groupExpression, Optional.of(getLogicalProperties()), left(), right(), joinReorderContext);
     }
 
     @Override
     public LogicalJoin<Plan, Plan> withLogicalProperties(Optional<LogicalProperties> logicalProperties) {
-        LogicalJoin<Plan, Plan> newJoin = new LogicalJoin<>(joinType, hashJoinConjuncts, otherJoinConjuncts, hint,
-                markJoinSlotReference,
-                Optional.empty(), logicalProperties, left(), right());
-        newJoin.getJoinReorderContext().copyFrom(this.getJoinReorderContext());
-        return newJoin;
+        return new LogicalJoin<>(joinType, hashJoinConjuncts, otherJoinConjuncts, hint, markJoinSlotReference,

Review Comment:
   two joins share one joinReorderContext. is it safe?



-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org