[fix](Nereids) should distribute first when do sort enforce on must shuffle (#30948)

This commit is contained in:
morrySnow
2024-02-07 16:44:51 +08:00
committed by yiguolei
parent 34de374e78
commit 1d10132aa1
2 changed files with 45 additions and 2 deletions

View File

@ -130,9 +130,13 @@ public class EnforceMissingPropertiesHelper {
private PhysicalProperties enforceSortAndDistribution(PhysicalProperties outputProperty,
PhysicalProperties requiredProperty) {
PhysicalProperties enforcedProperty;
PhysicalProperties enforcedProperty = outputProperty;
if (requiredProperty.getDistributionSpec().equals(new DistributionSpecGather())) {
enforcedProperty = enforceLocalSort(outputProperty, requiredProperty);
// NOTICE: if output is must shuffle, we must do distribution first. so add a random shuffle here.
if (outputProperty.getDistributionSpec() instanceof DistributionSpecMustShuffle) {
enforcedProperty = enforceDistribution(enforcedProperty, PhysicalProperties.EXECUTION_ANY);
}
enforcedProperty = enforceLocalSort(enforcedProperty, requiredProperty);
enforcedProperty = enforceDistribution(enforcedProperty, requiredProperty);
enforcedProperty = enforceGlobalSort(enforcedProperty, requiredProperty);
} else {