2010YOUY01 commented on code in PR #14946: URL: https://github.com/apache/datafusion/pull/14946#discussion_r1976265670
########## datafusion/physical-plan/src/aggregates/mod.rs: ########## @@ -57,41 +57,53 @@ mod row_hash; mod topk; mod topk_stream; -/// Hash aggregate modes +/// Aggregation modes /// /// See [`Accumulator::state`] for background information on multi-phase /// aggregation and how these modes are used. #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum AggregateMode { + /// One of multiple layers of aggregation, any input partitioning + /// /// Partial aggregate that can be applied in parallel across input /// partitions. /// /// This is the first phase of a multi-phase aggregation. Partial, + /// *Final* of multiple layers of aggregation, in exactly one partition + /// /// Final aggregate that produces a single partition of output by combining /// the output of multiple partial aggregates. /// /// This is the second phase of a multi-phase aggregation. + /// + /// This mode requires that the input is a single partition Review Comment: ```suggestion /// This mode requires that the input is a single partition /// /// Note: Adjacent `Partial` and `Final` mode aggregation is equivalent to a `Single` /// mode aggregation node. The `Final` mode is required since this is used in an /// intermediate step. The [`CombinePartialFinalAggregate`] physical optimizer rule /// will replace this combination with `Single` mode for more efficient execution. ``` At first this `Final` mode looks redundant to me, then I found one optimizer rule to explain https://github.com/apache/datafusion/blob/main/datafusion/physical-optimizer/src/combine_partial_final_agg.rs -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org