xzj7019 commented on code in PR #39148:
URL: https://github.com/apache/doris/pull/39148#discussion_r1715303095
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriver.java:
##########
@@ -258,8 +258,35 @@ public PhysicalProperties visitPhysicalHashJoin(
// broadcast
if (rightOutputProperty.getDistributionSpec() instanceof
DistributionSpecReplicated) {
- DistributionSpec parentDistributionSpec =
leftOutputProperty.getDistributionSpec();
- return new PhysicalProperties(parentDistributionSpec);
+ DistributionSpec leftDistributionSpec =
leftOutputProperty.getDistributionSpec();
+ if
(hashJoin.child(0).getOutputSet().containsAll(hashJoin.getOutputSet())) {
+ return new PhysicalProperties(leftDistributionSpec);
+ } else if (leftDistributionSpec instanceof DistributionSpecHash
+ && !(hashJoin.isMarkJoin() &&
hashJoin.getHashJoinConjuncts().isEmpty())
+ && !hashJoin.getHashConjunctsExprIds().first.isEmpty()
+ && !hashJoin.getHashConjunctsExprIds().second.isEmpty()
+ && hashJoin.getHashConjunctsExprIds().first.size()
+ == hashJoin.getHashConjunctsExprIds().second.size()
+ && hashJoin.getHashConjunctsExprIds().first.containsAll(
+ ((DistributionSpecHash)
leftDistributionSpec).getOrderedShuffledColumns())) {
Review Comment:
done
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/properties/ChildOutputPropertyDeriver.java:
##########
@@ -258,8 +258,35 @@ public PhysicalProperties visitPhysicalHashJoin(
// broadcast
if (rightOutputProperty.getDistributionSpec() instanceof
DistributionSpecReplicated) {
- DistributionSpec parentDistributionSpec =
leftOutputProperty.getDistributionSpec();
- return new PhysicalProperties(parentDistributionSpec);
+ DistributionSpec leftDistributionSpec =
leftOutputProperty.getDistributionSpec();
+ if
(hashJoin.child(0).getOutputSet().containsAll(hashJoin.getOutputSet())) {
+ return new PhysicalProperties(leftDistributionSpec);
+ } else if (leftDistributionSpec instanceof DistributionSpecHash
+ && !(hashJoin.isMarkJoin() &&
hashJoin.getHashJoinConjuncts().isEmpty())
+ && !hashJoin.getHashConjunctsExprIds().first.isEmpty()
+ && !hashJoin.getHashConjunctsExprIds().second.isEmpty()
+ && hashJoin.getHashConjunctsExprIds().first.size()
+ == hashJoin.getHashConjunctsExprIds().second.size()
+ && hashJoin.getHashConjunctsExprIds().first.containsAll(
+ ((DistributionSpecHash)
leftDistributionSpec).getOrderedShuffledColumns())) {
+ List<ExprId> leftIds =
hashJoin.getHashConjunctsExprIds().first;
+ List<ExprId> rightIds =
hashJoin.getHashConjunctsExprIds().second;
+ List<ExprId> usedRightExprIds = Lists.newArrayList();
+ for (ExprId exprId : ((DistributionSpecHash)
leftDistributionSpec).getOrderedShuffledColumns()) {
Review Comment:
done
--
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]