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 = get_factorized_chunk();
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 more