Skip to main content

aggregate_combine_callback

Macro aggregate_combine_callback 

Source
macro_rules! aggregate_combine_callback {
    ($name:ident, |$info:ident, $source:ident, $target:ident, $count:ident| $body:block) => { ... };
}
Expand description

Generates a panic-safe unsafe extern "C" aggregate combine callback.

Emits unsafe extern "C" fn $name(info: duckdb_function_info, source: *mut duckdb_aggregate_state, target: *mut duckdb_aggregate_state, count: idx_t).

§Pitfall L1

target states were set up by the aggregate’s init callback, not copied from anything, so the body must propagate every field of the state, not only the accumulated data. See CombineFn.

§Example

quack_rs::aggregate_combine_callback!(my_combine, |info, source, target, count| {
    let _ = (source, target, count);
});