pub struct Aggregator { /* private fields */ }Expand description
Aggregator that can apply multiple aggregations
Implementations§
Source§impl Aggregator
impl Aggregator
pub fn new() -> Self
pub fn add( self, alias: impl Into<String>, func: Box<dyn AggregateFunc>, field: Option<String>, ) -> Self
pub fn apply(&self, events: &[Event]) -> AggResult
Apply aggregations to SharedEvent slice (avoids cloning in hot paths)
Sourcepub fn apply_columnar(&self, buffer: &mut ColumnarBuffer) -> AggResult
pub fn apply_columnar(&self, buffer: &mut ColumnarBuffer) -> AggResult
Apply aggregations to a columnar buffer (SIMD-optimized).
This method uses lazy column extraction for SIMD operations on contiguous memory. Each field is extracted once and cached for subsequent aggregations on the same field.
§Example
let aggregator = Aggregator::new()
.add("total", Box::new(Sum), Some("price".to_string()))
.add("avg_price", Box::new(Avg), Some("price".to_string()))
.add("count", Box::new(Count), None);
let mut window = TumblingWindow::new(Duration::seconds(60));
// ... add events ...
let mut buffer = window.flush_columnar();
let results = aggregator.apply_columnar(&mut buffer);Trait Implementations§
Source§impl Debug for Aggregator
impl Debug for Aggregator
Auto Trait Implementations§
impl Freeze for Aggregator
impl !RefUnwindSafe for Aggregator
impl Send for Aggregator
impl Sync for Aggregator
impl Unpin for Aggregator
impl UnsafeUnpin for Aggregator
impl !UnwindSafe for Aggregator
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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