924060929 commented on code in PR #12130:
URL: https://github.com/apache/doris/pull/12130#discussion_r956860383
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java:
##########
@@ -363,32 +367,48 @@ public PlanFragment
visitPhysicalHashJoin(PhysicalHashJoin<Plan, Plan> hashJoin,
// NOTICE: We must visit from right to left, to ensure the last
fragment is root fragment
PlanFragment rightFragment = hashJoin.child(1).accept(this, context);
PlanFragment leftFragment = hashJoin.child(0).accept(this, context);
- PlanNode leftFragmentPlanRoot = leftFragment.getPlanRoot();
- PlanNode rightFragmentPlanRoot = rightFragment.getPlanRoot();
- JoinType joinType = hashJoin.getJoinType();
if (JoinUtils.shouldNestedLoopJoin(hashJoin)) {
throw new RuntimeException("Physical hash join could not execute
without equal join condition.");
}
- List<Expr> execEqConjunctList =
hashJoin.getHashJoinConjuncts().stream()
+ PlanNode leftPlanRoot = leftFragment.getPlanRoot();
+ PlanNode rightPlanRoot = rightFragment.getPlanRoot();
+ JoinType joinType = hashJoin.getJoinType();
+
+ List<Expr> execEqConjuncts = hashJoin.getHashJoinConjuncts().stream()
.map(EqualTo.class::cast)
.map(e -> swapEqualToForChildrenOrder(e,
hashJoin.left().getOutput()))
.map(e -> ExpressionTranslator.translate(e, context))
.collect(Collectors.toList());
+
+ // in Nereids, all node only has one TupleDescriptor, so we can use
the first one.
+ TupleDescriptor leftTuple =
context.getTupleDesc(leftPlanRoot.getTupleIds().get(0));
+ TupleDescriptor rightTuple =
context.getTupleDesc(rightPlanRoot.getTupleIds().get(0));
Review Comment:
If Nereids only has one TupleDescriptor, we should change the tupleIds to
tupleId, or else people who add new translate method maybe misuse?
So I suggest
```java
TupleDescriptor leftTuple = context.getTupleDesc(leftPlanRoot.getTupleId());
TupleDescriptor rightTuple =
context.getTupleDesc(rightPlanRoot.getTupleId());
```
--
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]