Skip to main content

aggregate_sorted

Function aggregate_sorted 

Source
pub fn aggregate_sorted(
    batch: &RecordBatch,
    functions: &[AggFn],
    field_columns: &[&str],
    group_by: &[&str],
    memory_tracker: Option<&MemoryTracker>,
) -> Result<RecordBatch>
Expand description

Sort-based group-by aggregation.

Sorts the batch on group-by columns, then iterates over contiguous runs of equal keys, accumulating into IncrementalAccumulator per field. Produces output in sorted group-key order.

Preferred for low-cardinality group-by where sort cost is small and the sorted output is often useful for downstream processing.

ยงErrors

Returns an error if required columns are missing.