@@ -36,7 +36,7 @@ use datafusion_common::config::ConfigOptions;
3636use datafusion_common:: error:: Result ;
3737use datafusion_common:: stats:: Precision ;
3838use datafusion_common:: tree_node:: { Transformed , TransformedResult , TreeNode } ;
39- use datafusion_expr:: logical_plan:: { Aggregate , JoinType } ;
39+ use datafusion_expr:: logical_plan:: JoinType ;
4040use datafusion_physical_expr:: expressions:: { Column , NoOp } ;
4141use datafusion_physical_expr:: utils:: map_columns_before_projection;
4242use datafusion_physical_expr:: {
@@ -1297,25 +1297,10 @@ pub fn ensure_distribution(
12971297 // Allow subset satisfaction when:
12981298 // 1. Current partition count >= threshold
12991299 // 2. Not a partitioned join since must use exact hash matching for joins
1300- // 3. Not a grouping set aggregate (requires exact hash including __grouping_id)
13011300 let current_partitions = child. plan . output_partitioning ( ) . partition_count ( ) ;
1302-
1303- // Check if the hash partitioning requirement includes __grouping_id column.
1304- // Grouping set aggregates (ROLLUP, CUBE, GROUPING SETS) require exact hash
1305- // partitioning on all group columns including __grouping_id to ensure partial
1306- // aggregates from different partitions are correctly combined.
1307- let requires_grouping_id = matches ! ( & requirement, Distribution :: HashPartitioned ( exprs)
1308- if exprs. iter( ) . any( |expr| {
1309- expr. as_any( )
1310- . downcast_ref:: <Column >( )
1311- . is_some_and( |col| col. name( ) == Aggregate :: INTERNAL_GROUPING_ID )
1312- } )
1313- ) ;
1314-
13151301 let allow_subset_satisfy_partitioning = current_partitions
13161302 >= subset_satisfaction_threshold
1317- && !is_partitioned_join
1318- && !requires_grouping_id;
1303+ && !is_partitioned_join;
13191304
13201305 // When `repartition_file_scans` is set, attempt to increase
13211306 // parallelism at the source.
0 commit comments