Skip to content

Commit

Permalink
Minor: improve GroupsAccumulator docs
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Sep 17, 2024
1 parent a08f923 commit 52fa1b8
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion datafusion/expr-common/src/groups_accumulator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 52fa1b8

Please sign in to comment.