pub struct AggregateFunctionInfo { /* private fields */ }Expand description
Ergonomic wrapper around the duckdb_function_info handle provided to
aggregate function callbacks (update, combine, finalize, etc.).
Provides access to extra info and error reporting.
Implementations§
Source§impl AggregateFunctionInfo
impl AggregateFunctionInfo
Sourcepub const unsafe fn new(info: duckdb_function_info) -> Self
pub const unsafe fn new(info: duckdb_function_info) -> Self
Wraps a raw duckdb_function_info provided by DuckDB inside an
aggregate function callback.
§Safety
info must be a valid duckdb_function_info passed by DuckDB to an
aggregate function callback.
Sourcepub unsafe fn get_extra_info(&self) -> *mut c_void
pub unsafe fn get_extra_info(&self) -> *mut c_void
Retrieves the extra-info pointer previously set via
AggregateFunctionBuilder::extra_info.
Returns a raw *mut c_void. Cast it back to your concrete type.
§Safety
The returned pointer is only valid as long as the aggregate function is
registered and DuckDB has not yet called the destructor.
Sourcepub unsafe fn extra_info_ref<T: 'static>(&self) -> Option<&T>
pub unsafe fn extra_info_ref<T: 'static>(&self) -> Option<&T>
Borrows the extra info set with extra_info_typed (on
AggregateFunctionBuilder
or AggregateOverloadBuilder)
as a T; None when none was set or it holds another type.
§Safety
This function’s extra info, if any, was set through extra_info_typed
and not through the raw extra_info: the type tag read here is the
one extra_info_typed writes, and a raw pointer carries none.
Sourcepub fn set_error(&self, message: &str)
pub fn set_error(&self, message: &str)
Reports an error from an aggregate function callback, causing DuckDB
to abort the current query.
An interior NUL byte in message is replaced with ?
(see message_to_c_string),
and an empty message by EMPTY_ERROR_PLACEHOLDER, since DuckDB
would otherwise report only an error-type prefix.
Called from finalize, the query fails but DuckDB does not destroy
every aggregate state it created, so whatever those states own (an
FfiState box, for one) leaks. That
holds for a grouped aggregate on every release up to 2.0.0, and for an
ungrouped one before 2.0.0, which plans a C API aggregate as a hash
aggregate; 2.0.0 runs an ungrouped aggregate in
PhysicalUngroupedAggregate, which destroys its states. See Known
Limitations in the book.