#[repr(C)]pub struct FFI_ScalarFunction {
pub ctx: *const c_void,
pub name: unsafe extern "C" fn(ctx: *const c_void) -> *const c_char,
pub get_return_field: unsafe extern "C" fn(ctx: *const c_void, args: *const ArrowSchema, args_count: usize, ret: *mut ArrowSchema, errmsg: *mut *mut c_char) -> c_int,
pub call: unsafe extern "C" fn(ctx: *const c_void, args: *const ArrowArray, args_schemas: *const ArrowSchema, args_count: usize, ret_array: *mut ArrowArray, ret_schema: *mut ArrowSchema, errmsg: *mut *mut c_char) -> c_int,
pub fini: unsafe extern "C" fn(ctx: *mut c_void),
}Expand description
Virtual function table for a scalar function.
The host calls methods through these function pointers. ctx is an opaque
pointer owned by the module; the host never dereferences it directly.
Fields§
§ctx: *const c_voidOpaque module-side context pointer.
name: unsafe extern "C" fn(ctx: *const c_void) -> *const c_charReturn the function name as a null-terminated UTF-8 string.
The returned pointer borrows from ctx and is valid until fini.
get_return_field: unsafe extern "C" fn(ctx: *const c_void, args: *const ArrowSchema, args_count: usize, ret: *mut ArrowSchema, errmsg: *mut *mut c_char) -> c_intCompute the output field given input fields.
args points to args_count Arrow field schemas (C Data Interface).
On success, writes the result schema to *ret.
On error, writes a null-terminated message to *errmsg
(freed by FFI_Module::free_string).
Returns 0 on success, non-zero on error.
call: unsafe extern "C" fn(ctx: *const c_void, args: *const ArrowArray, args_schemas: *const ArrowSchema, args_count: usize, ret_array: *mut ArrowArray, ret_schema: *mut ArrowSchema, errmsg: *mut *mut c_char) -> c_intEvaluate the function on Arrow arrays via the C Data Interface.
On error, writes a null-terminated message to *errmsg
(freed by FFI_Module::free_string).
Returns 0 on success, non-zero on error.
fini: unsafe extern "C" fn(ctx: *mut c_void)Finalize the function, freeing all owned resources.