Apache DataFusion SQL Query Engine
Minor: improve GroupsAccumulator docs (#12501)
Andrew Lamb3fc99de9c0ed
diff --git a/datafusion/expr-common/src/groups_accumulator.rs b/datafusion/expr-common/src/groups_accumulator.rsindex 156e21d9ae..8e81c51d84 100644--- a/datafusion/expr-common/src/groups_accumulator.rs+++ b/datafusion/expr-common/src/groups_accumulator.rs@@ -56,9 +56,32 @@ impl EmitTo {}}-/// `GroupAccumulator` implements a single aggregate (e.g. AVG) and+/// `GroupsAccumulator` implements a single aggregate (e.g. AVG) and/// stores the state for *all* groups internally.///+/// Logically, a [`GroupsAccumulator`] stores a mapping from each group index to+/// the state of the aggregate for that group. For example an implementation for+/// `min` might look like+///+/// ```text+/// ┌─────┐+/// │ 0 │───────────▶ 100+/// ├─────┤+/// │ 1 │───────────▶ 200+/// └─────┘+/// ... ...+/// ┌─────┐+/// │ N-2 │───────────▶ 50+/// ├─────┤+/// │ N-1 │───────────▶ 200+/// └─────┘+///+///+/// Logical group Current Min+/// number value for that+/// group+/// ```+////// # Notes on Implementing `GroupAccumulator`////// All aggregates must first implement the simpler [`Accumulator`] trait, which