Skip to main content

Module aggregate

Module aggregate 

Source
Expand description

DuckDB scalar functions: row-wise functions used in a SELECT list or WHERE clause. DuckDB aggregate functions: functions that fold many rows into one value per group, e.g. SELECT my_sum(x) FROM t GROUP BY k.

An aggregate is defined by a per-group State and four callbacks — init, update, combine, finalize — plus a destructor. DuckDB allocates the raw state bytes uninitialised, so the state is wrapped in a RawState that pairs the value with an initialised flag (a MaybeUninit guard), and every callback that runs user code is wrapped in contain_callback so a panic can never cross the C boundary.

Structs§

AggregateSetBuilder
Collects aggregate overloads into a function set (see Connection::register_aggregate_function_set).

Traits§

VAggregate
A DuckDB aggregate function: folds a set of input rows into one result value.