[fix](Nereids) fix bugs in test join5 (#16312)

make bucket-shuffle-join in PhysicalPlanTranlator when property of left child is not enforced
This commit is contained in:
谢健
2023-02-02 16:51:45 +08:00
committed by GitHub
parent 68d2067f51
commit 398da44e46
3 changed files with 39 additions and 30 deletions

View File

@ -1553,6 +1553,7 @@ public class PhysicalPlanTranslator extends DefaultPlanVisitor<PlanFragment, Pla
// according to left partition to generate right partition expr list
DistributionSpecHash leftDistributionSpec
= (DistributionSpecHash) physicalHashJoin.left().getPhysicalProperties().getDistributionSpec();
Pair<List<ExprId>, List<ExprId>> onClauseUsedSlots = JoinUtils.getOnClauseUsedSlots(physicalHashJoin);
List<ExprId> rightPartitionExprIds = Lists.newArrayList(leftDistributionSpec.getOrderedShuffledColumns());
for (int i = 0; i < leftDistributionSpec.getOrderedShuffledColumns().size(); i++) {
@ -1572,11 +1573,14 @@ public class PhysicalPlanTranslator extends DefaultPlanVisitor<PlanFragment, Pla
}
// assemble fragment
hashJoinNode.setDistributionMode(HashJoinNode.DistributionMode.BUCKET_SHUFFLE);
if (leftDistributionSpec.getShuffleType() != ShuffleType.NATURAL) {
if (leftDistributionSpec.getShuffleType() != ShuffleType.NATURAL
&& leftDistributionSpec.getShuffleType() != ShuffleType.BUCKETED) {
hashJoinNode.setDistributionMode(DistributionMode.PARTITIONED);
}
connectChildFragment(hashJoinNode, 1, leftFragment, rightFragment, context);
leftFragment.setPlanRoot(hashJoinNode);
// HASH_PARTITIONED and BUCKET_SHFFULE_HASH_PARTITIONED are two type of hash algorithm
// And the nature left child means it use BUCKET_SHFFULE_HASH_PARTITIONED in storage layer
TPartitionType partitionType = TPartitionType.BUCKET_SHFFULE_HASH_PARTITIONED;
if (leftDistributionSpec.getShuffleType() != ShuffleType.NATURAL) {
partitionType = TPartitionType.HASH_PARTITIONED;

View File

@ -289,10 +289,13 @@ public class DistributionSpecHash extends DistributionSpec {
* Enums for concrete shuffle type.
*/
public enum ShuffleType {
// 1. The following properties are the required properties for children
// require, need to satisfy the distribution spec by aggregation way.
AGGREGATE,
// require, need to satisfy the distribution spec by join way.
JOIN,
// 2. The following properties are the output properties from some operators
// output, for olap scan node and colocate join
NATURAL,
// output, for all join except colocate join