|
55 | 55 |
|
56 | 56 | import com.google.common.base.Preconditions; |
57 | 57 | import com.google.common.collect.ImmutableList; |
58 | | -import com.google.common.collect.ImmutableSet; |
59 | 58 | import com.google.common.collect.Lists; |
60 | 59 | import org.apache.logging.log4j.LogManager; |
61 | 60 | import org.apache.logging.log4j.Logger; |
@@ -626,80 +625,83 @@ public List<List<PhysicalProperties>> visitPhysicalSetOperation(PhysicalSetOpera |
626 | 625 | } else if (requiredDistributionSpec instanceof DistributionSpecHash) { |
627 | 626 | // TODO: should use the most common hash spec as basic |
628 | 627 | DistributionSpecHash basic = (DistributionSpecHash) requiredDistributionSpec; |
629 | | - int bucketShuffleBasicIndex = -1; |
630 | | - double basicRowCount = -1; |
| 628 | + // TODO: open comment when support `enable_local_shuffle_planner` |
| 629 | + // int bucketShuffleBasicIndex = -1; |
| 630 | + // double basicRowCount = -1; |
631 | 631 |
|
632 | 632 | // find the bucket shuffle basic index |
633 | | - try { |
634 | | - ImmutableSet<ShuffleType> supportBucketShuffleTypes = ImmutableSet.of( |
635 | | - ShuffleType.NATURAL, |
636 | | - ShuffleType.STORAGE_BUCKETED |
637 | | - ); |
638 | | - for (int i = 0; i < originChildrenProperties.size(); i++) { |
639 | | - PhysicalProperties originChildrenProperty = originChildrenProperties.get(i); |
640 | | - DistributionSpec childDistribution = originChildrenProperty.getDistributionSpec(); |
641 | | - if (childDistribution instanceof DistributionSpecHash |
642 | | - && supportBucketShuffleTypes.contains( |
643 | | - ((DistributionSpecHash) childDistribution).getShuffleType()) |
644 | | - && !(isBucketShuffleDownGrade(setOperation.child(i)))) { |
645 | | - Statistics stats = setOperation.child(i).getStats(); |
646 | | - double rowCount = stats.getRowCount(); |
647 | | - if (rowCount > basicRowCount) { |
648 | | - basicRowCount = rowCount; |
649 | | - bucketShuffleBasicIndex = i; |
650 | | - } |
651 | | - } |
652 | | - } |
653 | | - } catch (Throwable t) { |
654 | | - // catch stats exception |
655 | | - LOG.warn("Can not find the most (bucket num, rowCount): " + t, t); |
656 | | - bucketShuffleBasicIndex = -1; |
657 | | - } |
| 633 | + // try { |
| 634 | + // ImmutableSet<ShuffleType> supportBucketShuffleTypes = ImmutableSet.of( |
| 635 | + // ShuffleType.NATURAL, |
| 636 | + // ShuffleType.STORAGE_BUCKETED |
| 637 | + // ); |
| 638 | + // for (int i = 0; i < originChildrenProperties.size(); i++) { |
| 639 | + // PhysicalProperties originChildrenProperty = originChildrenProperties.get(i); |
| 640 | + // DistributionSpec childDistribution = originChildrenProperty.getDistributionSpec(); |
| 641 | + // if (childDistribution instanceof DistributionSpecHash |
| 642 | + // && supportBucketShuffleTypes.contains( |
| 643 | + // ((DistributionSpecHash) childDistribution).getShuffleType()) |
| 644 | + // && !(isBucketShuffleDownGrade(setOperation.child(i)))) { |
| 645 | + // Statistics stats = setOperation.child(i).getStats(); |
| 646 | + // double rowCount = stats.getRowCount(); |
| 647 | + // if (rowCount > basicRowCount) { |
| 648 | + // basicRowCount = rowCount; |
| 649 | + // bucketShuffleBasicIndex = i; |
| 650 | + // } |
| 651 | + // } |
| 652 | + // } |
| 653 | + // } catch (Throwable t) { |
| 654 | + // // catch stats exception |
| 655 | + // LOG.warn("Can not find the most (bucket num, rowCount): " + t, t); |
| 656 | + // bucketShuffleBasicIndex = -1; |
| 657 | + // } |
658 | 658 |
|
659 | 659 | // use bucket shuffle |
660 | | - if (bucketShuffleBasicIndex >= 0) { |
661 | | - DistributionSpecHash notShuffleSideRequire |
662 | | - = (DistributionSpecHash) requiredProperties.get(bucketShuffleBasicIndex).getDistributionSpec(); |
663 | | - |
664 | | - DistributionSpecHash notNeedShuffleOutput |
665 | | - = (DistributionSpecHash) originChildrenProperties.get(bucketShuffleBasicIndex) |
666 | | - .getDistributionSpec(); |
667 | | - |
668 | | - for (int i = 0; i < originChildrenProperties.size(); i++) { |
669 | | - DistributionSpecHash current |
670 | | - = (DistributionSpecHash) originChildrenProperties.get(i).getDistributionSpec(); |
671 | | - if (i == bucketShuffleBasicIndex) { |
672 | | - continue; |
673 | | - } |
674 | | - |
675 | | - DistributionSpecHash currentRequire |
676 | | - = (DistributionSpecHash) requiredProperties.get(i).getDistributionSpec(); |
677 | | - |
678 | | - PhysicalProperties target = calAnotherSideRequired( |
679 | | - ShuffleType.STORAGE_BUCKETED, |
680 | | - notNeedShuffleOutput, current, |
681 | | - notShuffleSideRequire, |
682 | | - currentRequire); |
683 | | - updateChildEnforceAndCost(i, target); |
684 | | - } |
685 | | - setOperation.setMutableState(PhysicalSetOperation.DISTRIBUTE_TO_CHILD_INDEX, bucketShuffleBasicIndex); |
| 660 | + // if (bucketShuffleBasicIndex >= 0) { |
| 661 | + // DistributionSpecHash notShuffleSideRequire |
| 662 | + // = (DistributionSpecHash) requiredProperties.get(bucketShuffleBasicIndex) |
| 663 | + // .getDistributionSpec(); |
| 664 | + // |
| 665 | + // DistributionSpecHash notNeedShuffleOutput |
| 666 | + // = (DistributionSpecHash) originChildrenProperties.get(bucketShuffleBasicIndex) |
| 667 | + // .getDistributionSpec(); |
| 668 | + // |
| 669 | + // for (int i = 0; i < originChildrenProperties.size(); i++) { |
| 670 | + // DistributionSpecHash current |
| 671 | + // = (DistributionSpecHash) originChildrenProperties.get(i).getDistributionSpec(); |
| 672 | + // if (i == bucketShuffleBasicIndex) { |
| 673 | + // continue; |
| 674 | + // } |
| 675 | + // |
| 676 | + // DistributionSpecHash currentRequire |
| 677 | + // = (DistributionSpecHash) requiredProperties.get(i).getDistributionSpec(); |
| 678 | + // |
| 679 | + // PhysicalProperties target = calAnotherSideRequired( |
| 680 | + // ShuffleType.STORAGE_BUCKETED, |
| 681 | + // notNeedShuffleOutput, current, |
| 682 | + // notShuffleSideRequire, |
| 683 | + // currentRequire); |
| 684 | + // updateChildEnforceAndCost(i, target); |
| 685 | + // } |
| 686 | + // setOperation.setMutableState( |
| 687 | + // PhysicalSetOperation.DISTRIBUTE_TO_CHILD_INDEX, bucketShuffleBasicIndex); |
686 | 688 | // use partitioned shuffle |
687 | | - } else { |
688 | | - for (int i = 0; i < originChildrenProperties.size(); i++) { |
689 | | - DistributionSpecHash current |
690 | | - = (DistributionSpecHash) originChildrenProperties.get(i).getDistributionSpec(); |
691 | | - if (current.getShuffleType() != ShuffleType.EXECUTION_BUCKETED |
692 | | - || !bothSideShuffleKeysAreSameOrder(basic, current, |
| 689 | + // } else { |
| 690 | + for (int i = 0; i < originChildrenProperties.size(); i++) { |
| 691 | + DistributionSpecHash current |
| 692 | + = (DistributionSpecHash) originChildrenProperties.get(i).getDistributionSpec(); |
| 693 | + if (current.getShuffleType() != ShuffleType.EXECUTION_BUCKETED |
| 694 | + || !bothSideShuffleKeysAreSameOrder(basic, current, |
| 695 | + (DistributionSpecHash) requiredProperties.get(0).getDistributionSpec(), |
| 696 | + (DistributionSpecHash) requiredProperties.get(i).getDistributionSpec())) { |
| 697 | + PhysicalProperties target = calAnotherSideRequired( |
| 698 | + ShuffleType.EXECUTION_BUCKETED, basic, current, |
693 | 699 | (DistributionSpecHash) requiredProperties.get(0).getDistributionSpec(), |
694 | | - (DistributionSpecHash) requiredProperties.get(i).getDistributionSpec())) { |
695 | | - PhysicalProperties target = calAnotherSideRequired( |
696 | | - ShuffleType.EXECUTION_BUCKETED, basic, current, |
697 | | - (DistributionSpecHash) requiredProperties.get(0).getDistributionSpec(), |
698 | | - (DistributionSpecHash) requiredProperties.get(i).getDistributionSpec()); |
699 | | - updateChildEnforceAndCost(i, target); |
700 | | - } |
| 700 | + (DistributionSpecHash) requiredProperties.get(i).getDistributionSpec()); |
| 701 | + updateChildEnforceAndCost(i, target); |
701 | 702 | } |
702 | 703 | } |
| 704 | + // } |
703 | 705 | } |
704 | 706 | return ImmutableList.of(originChildrenProperties); |
705 | 707 | } |
|
0 commit comments