gabotechs commented on code in PR #23239:
URL: https://github.com/apache/datafusion/pull/23239#discussion_r3497049720
##########
datafusion/core/tests/physical_optimizer/enforce_distribution.rs:
##########
@@ -700,6 +748,201 @@ impl TestConfig {
}
}
+#[test]
+fn range_aggregate_keeps_range_partitioning_at_subset_threshold() ->
Result<()> {
+ let input = parquet_exec_with_output_partitioning(range_partitioning(
+ "a",
+ [10, 20, 30],
+ SortOptions::default(),
+ )?);
+ let aggregate =
+ aggregate_exec_with_alias(input, vec![("a".to_string(),
"a".to_string())]);
+
+ let plan = TestConfig::default()
+ .with_query_execution_partitions(4)
+ .to_plan(aggregate, &DISTRIB_DISTRIB_SORT);
+
+ assert_plan!(
+ plan,
+ @r"
+ AggregateExec: mode=FinalPartitioned, gby=[a@0 as a], aggr=[]
+ AggregateExec: mode=Partial, gby=[a@0 as a], aggr=[]
+ DataSourceExec: file_groups={4 groups: [[p0], [p1], [p2], [p3]]},
projection=[a, b, c, d, e], output_partitioning=Range([a@0 ASC], [(10), (20),
(30)], 4), file_type=parquet
Review Comment:
Indeed, tweaking the plan like this:
```rust
let plan = CombinePartialFinalAggregate::new().optimize(plan,
&ConfigOptions::new())?;
```
Produces the following plan:
```rust
AggregateExec: mode=SinglePartitioned, gby=[a@0 as a], aggr=[]
DataSourceExec: file_groups={4 groups: [[p0], [p1], [p2], [p3]]},
projection=[a, b, c, d, e], output_partitioning=Range([a@0 ASC], [(10), (20),
(30)], 4), file_type=parquet
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]