wiedld commented on code in PR #14637:
URL: https://github.com/apache/datafusion/pull/14637#discussion_r1957032310
##########
datafusion/physical-optimizer/src/enforce_sorting/mod.rs:
##########
@@ -138,27 +138,25 @@ fn is_coalesce_to_remove(
node: &Arc<dyn ExecutionPlan>,
parent: &Arc<dyn ExecutionPlan>,
) -> bool {
- node.as_any()
- .downcast_ref::<CoalescePartitionsExec>()
+ node.as_any().downcast_ref::<CoalescePartitionsExec>()
.map(|_coalesce| {
// TODO(wiedld): find a more generalized approach that does not
rely on
// pattern matching the structure of the DAG
// Note that the `Partitioning::satisfy()` (parent vs.
coalesce.child) cannot be used for cases of:
// * Repartition -> Coalesce -> Repartition
+ // * Coalesce -> AggregateExec(input=hash-partitioned)
- let parent_req_single_partition = matches!(
- parent.required_input_distribution()[0],
- Distribution::SinglePartition
- );
+ let parent_req_single_partition =
matches!(parent.required_input_distribution()[0], Distribution::SinglePartition)
+ // handle aggregates with input=hashPartitioning with a single
output partition
+ || (is_aggregate(parent) &&
parent.properties().output_partitioning().partition_count() <= 1);
Review Comment:
This single line is the fix for our found issue.
It's also isolated in it's [own
commit](https://github.com/apache/datafusion/pull/14637/commits/89556c2885a2277b6c969555ffdacecda2be38e1),
with the fixed test case.
--
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]