pub struct MergeAggregator { /* private fields */ }Expand description
Combines partial aggregates from multiple partitions into final results.
The merge step runs on Ring 2 (control plane). It groups partials by group key and merges each group’s partial states into a single combined state per function.
Implementations§
Source§impl MergeAggregator
impl MergeAggregator
Sourcepub fn new(kinds: Vec<TwoPhaseKind>) -> Self
pub fn new(kinds: Vec<TwoPhaseKind>) -> Self
Create a new merge aggregator for the given function kinds.
Sourcepub fn merge_group(
&self,
partials: &[&PartialAggregate],
) -> Result<Vec<PartialState>, TwoPhaseError>
pub fn merge_group( &self, partials: &[&PartialAggregate], ) -> Result<Vec<PartialState>, TwoPhaseError>
Merge partials for a single group key.
§Errors
Returns TwoPhaseError::FunctionCountMismatch if any partial
has a different number of states than expected.
Sourcepub fn merge_all(
&self,
partials: &[PartialAggregate],
) -> Result<FxHashMap<Vec<u8>, Vec<PartialState>>, TwoPhaseError>
pub fn merge_all( &self, partials: &[PartialAggregate], ) -> Result<FxHashMap<Vec<u8>, Vec<PartialState>>, TwoPhaseError>
Merge all partials into per-group final states.
Groups the partials by group_key, merges each group, and returns
a map of group_key → merged_states.
§Errors
Returns TwoPhaseError::FunctionCountMismatch if any partial
has a mismatched number of states.
Sourcepub fn finalize(states: &[PartialState]) -> Vec<f64>
pub fn finalize(states: &[PartialState]) -> Vec<f64>
Finalize a vector of merged partial states to f64 results.
Sourcepub fn num_functions(&self) -> usize
pub fn num_functions(&self) -> usize
Number of aggregate functions.
Sourcepub fn kinds(&self) -> &[TwoPhaseKind]
pub fn kinds(&self) -> &[TwoPhaseKind]
The function kinds in order.
Auto Trait Implementations§
impl Freeze for MergeAggregator
impl RefUnwindSafe for MergeAggregator
impl Send for MergeAggregator
impl Sync for MergeAggregator
impl Unpin for MergeAggregator
impl UnsafeUnpin for MergeAggregator
impl UnwindSafe for MergeAggregator
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more