Commit f9bc035
[SPARK-32056][SQL] Coalesce partitions for repartition by expressions when AQE is enabled
This patch proposes to coalesce partitions for repartition by expressions without specifying number of partitions, when AQE is enabled.
When repartition by some partition expressions, users can specify number of partitions or not. If the number of partitions is specified, we should not coalesce partitions because it breaks user expectation. But if without specifying number of partitions, AQE should be able to coalesce partitions as other shuffling.
Yes. After this change, if users don't specify the number of partitions when repartitioning data by expressions, AQE will coalesce partitions.
Added unit test.
Closes apache#28900 from viirya/SPARK-32056.
Authored-by: Liang-Chi Hsieh <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>1 parent f099edb commit f9bc035
File tree
4 files changed
+119
-31
lines changed- sql
- catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical
- core/src
- main/scala/org/apache/spark/sql
- execution
- test/scala/org/apache/spark/sql/execution/adaptive
4 files changed
+119
-31
lines changedLines changed: 15 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
948 | 949 | | |
949 | 950 | | |
950 | 951 | | |
951 | | - | |
| 952 | + | |
952 | 953 | | |
953 | 954 | | |
954 | | - | |
| 955 | + | |
| 956 | + | |
955 | 957 | | |
956 | 958 | | |
957 | 959 | | |
958 | 960 | | |
959 | | - | |
| 961 | + | |
960 | 962 | | |
| 963 | + | |
961 | 964 | | |
962 | 965 | | |
963 | 966 | | |
| |||
985 | 988 | | |
986 | 989 | | |
987 | 990 | | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
988 | 1000 | | |
989 | 1001 | | |
990 | 1002 | | |
| |||
Lines changed: 33 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2991 | 2991 | | |
2992 | 2992 | | |
2993 | 2993 | | |
2994 | | - | |
2995 | | - | |
2996 | | - | |
2997 | | - | |
2998 | | - | |
2999 | | - | |
3000 | | - | |
3001 | | - | |
3002 | | - | |
3003 | | - | |
3004 | | - | |
| 2994 | + | |
| 2995 | + | |
| 2996 | + | |
3005 | 2997 | | |
3006 | 2998 | | |
3007 | 2999 | | |
| |||
3015 | 3007 | | |
3016 | 3008 | | |
3017 | 3009 | | |
| 3010 | + | |
| 3011 | + | |
| 3012 | + | |
| 3013 | + | |
| 3014 | + | |
| 3015 | + | |
| 3016 | + | |
| 3017 | + | |
| 3018 | + | |
| 3019 | + | |
| 3020 | + | |
| 3021 | + | |
| 3022 | + | |
| 3023 | + | |
3018 | 3024 | | |
3019 | 3025 | | |
3020 | 3026 | | |
| |||
3027 | 3033 | | |
3028 | 3034 | | |
3029 | 3035 | | |
3030 | | - | |
| 3036 | + | |
| 3037 | + | |
| 3038 | + | |
| 3039 | + | |
| 3040 | + | |
| 3041 | + | |
| 3042 | + | |
| 3043 | + | |
| 3044 | + | |
| 3045 | + | |
| 3046 | + | |
| 3047 | + | |
| 3048 | + | |
| 3049 | + | |
3031 | 3050 | | |
3032 | 3051 | | |
3033 | 3052 | | |
| |||
3049 | 3068 | | |
3050 | 3069 | | |
3051 | 3070 | | |
3052 | | - | |
3053 | | - | |
3054 | | - | |
3055 | | - | |
3056 | | - | |
3057 | | - | |
3058 | | - | |
3059 | | - | |
| 3071 | + | |
3060 | 3072 | | |
3061 | 3073 | | |
3062 | 3074 | | |
| |||
3078 | 3090 | | |
3079 | 3091 | | |
3080 | 3092 | | |
3081 | | - | |
| 3093 | + | |
3082 | 3094 | | |
3083 | 3095 | | |
3084 | 3096 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
787 | 787 | | |
788 | 788 | | |
789 | 789 | | |
| 790 | + | |
790 | 791 | | |
791 | | - | |
| 792 | + | |
792 | 793 | | |
793 | 794 | | |
794 | 795 | | |
| |||
Lines changed: 69 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
874 | 874 | | |
875 | 875 | | |
876 | 876 | | |
877 | | - | |
| 877 | + | |
878 | 878 | | |
879 | 879 | | |
880 | 880 | | |
881 | | - | |
882 | | - | |
883 | | - | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
884 | 891 | | |
885 | | - | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
886 | 903 | | |
887 | | - | |
| 904 | + | |
| 905 | + | |
888 | 906 | | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
889 | 952 | | |
890 | 953 | | |
891 | 954 | | |
| |||
0 commit comments