pub struct GroupsAccumulatorAdapter { /* private fields */ }
Expand description
An adapter that implements GroupsAccumulator
for any Accumulator
While Accumulator
are simpler to implement and can support
more general calculations (like retractable window functions),
they are not as fast as a specialized GroupsAccumulator
. This
interface bridges the gap so the group by operator only operates
in terms of Accumulator
.
Implementations§
source§impl GroupsAccumulatorAdapter
impl GroupsAccumulatorAdapter
sourcepub fn new<F>(factory: F) -> Selfwhere
F: Fn() -> Result<Box<dyn Accumulator>> + Send + 'static,
pub fn new<F>(factory: F) -> Selfwhere F: Fn() -> Result<Box<dyn Accumulator>> + Send + 'static,
Create a new adapter that will create a new Accumulator
for each group, using the specified factory function
Trait Implementations§
source§impl GroupsAccumulator for GroupsAccumulatorAdapter
impl GroupsAccumulator for GroupsAccumulatorAdapter
source§fn update_batch(
&mut self,
values: &[ArrayRef],
group_indices: &[usize],
opt_filter: Option<&BooleanArray>,
total_num_groups: usize
) -> Result<()>
fn update_batch( &mut self, values: &[ArrayRef], group_indices: &[usize], opt_filter: Option<&BooleanArray>, total_num_groups: usize ) -> Result<()>
source§fn evaluate(&mut self, emit_to: EmitTo) -> Result<ArrayRef>
fn evaluate(&mut self, emit_to: EmitTo) -> Result<ArrayRef>
Returns the final aggregate value for each group as a single
RecordBatch
, resetting the internal state. Read moresource§fn state(&mut self, emit_to: EmitTo) -> Result<Vec<ArrayRef>>
fn state(&mut self, emit_to: EmitTo) -> Result<Vec<ArrayRef>>
Returns the intermediate aggregate state for this accumulator,
used for multi-phase grouping, resetting its internal state. Read more
source§fn merge_batch(
&mut self,
values: &[ArrayRef],
group_indices: &[usize],
opt_filter: Option<&BooleanArray>,
total_num_groups: usize
) -> Result<()>
fn merge_batch( &mut self, values: &[ArrayRef], group_indices: &[usize], opt_filter: Option<&BooleanArray>, total_num_groups: usize ) -> Result<()>
Merges intermediate state (the output from
Self::state
)
into this accumulator’s values. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for GroupsAccumulatorAdapter
impl Send for GroupsAccumulatorAdapter
impl !Sync for GroupsAccumulatorAdapter
impl Unpin for GroupsAccumulatorAdapter
impl !UnwindSafe for GroupsAccumulatorAdapter
Blanket Implementations§
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
Mutably borrows from an owned value. Read more