pub enum FactorizedAggregate {
Count,
CountColumn {
column_idx: usize,
},
Sum {
column_idx: usize,
},
Avg {
column_idx: usize,
},
Min {
column_idx: usize,
},
Max {
column_idx: usize,
},
}Expand description
Types of aggregates that can be computed on factorized data.
Variants§
Count
COUNT(*) - total logical row count.
CountColumn
COUNT(column) - count non-null values in a column at deepest level.
Sum
SUM(column) - sum of values at deepest level, weighted by multiplicity.
Avg
AVG(column) - average of values at deepest level.
Min
MIN(column) - minimum value at deepest level.
Max
MAX(column) - maximum value at deepest level.
Implementations§
Source§impl FactorizedAggregate
impl FactorizedAggregate
Sourcepub fn count_column(column_idx: usize) -> Self
pub fn count_column(column_idx: usize) -> Self
Creates a COUNT(column) aggregate.
Sourcepub fn compute(&self, chunk: &FactorizedChunk) -> Value
pub fn compute(&self, chunk: &FactorizedChunk) -> Value
Computes this aggregate on a factorized chunk.
§Arguments
chunk- The factorized chunk to aggregate
§Returns
The aggregate result as a Value.
§Note
For multiple aggregates on the same chunk, prefer using
compute_with_multiplicities with
precomputed multiplicities to avoid O(levels) recomputation per aggregate.
Sourcepub fn compute_with_multiplicities(
&self,
chunk: &FactorizedChunk,
multiplicities: Option<&[usize]>,
) -> Value
pub fn compute_with_multiplicities( &self, chunk: &FactorizedChunk, multiplicities: Option<&[usize]>, ) -> Value
Computes this aggregate using precomputed multiplicities.
This is more efficient when computing multiple aggregates on the same chunk, as multiplicities only need to be computed once.
§Arguments
chunk- The factorized chunk to aggregatemultiplicities- Precomputed path multiplicities (fromchunk.path_multiplicities_cached())
§Returns
The aggregate result as a Value.
§Example
let mut chunk = FactorizedChunk::empty();
let mults = chunk.path_multiplicities_cached();
// Compute multiple aggregates with O(1) cached lookup each
let count = FactorizedAggregate::count().compute_with_multiplicities(&chunk, Some(&mults));
let sum = FactorizedAggregate::sum(0).compute_with_multiplicities(&chunk, Some(&mults));Sourcepub fn output_type(&self) -> LogicalType
pub fn output_type(&self) -> LogicalType
Returns the output type for this aggregate.
Trait Implementations§
Source§impl Clone for FactorizedAggregate
impl Clone for FactorizedAggregate
Source§fn clone(&self) -> FactorizedAggregate
fn clone(&self) -> FactorizedAggregate
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for FactorizedAggregate
impl RefUnwindSafe for FactorizedAggregate
impl Send for FactorizedAggregate
impl Sync for FactorizedAggregate
impl Unpin for FactorizedAggregate
impl UnsafeUnpin for FactorizedAggregate
impl UnwindSafe for FactorizedAggregate
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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