Skip to content
Query.Farm
Talk with Us

Arguments

On this page

Declaring a signature, and reading the values that arrive.

source
pub struct Arguments {
pub positional: Vec<Option<ArrayRef>>,
pub named: HashMap<String, ArrayRef>,
pub schema: Option<SchemaRef>,
pub positional_fields: Vec<Option<Field>>,
}

Description

Parsed function arguments.

Methods

source
pub fn arg(&self, pos: usize) -> Option<&ArrayRef>

The 1-row array of the positional argument at pos, if present.

source
pub fn arg_field(&self, pos: usize) -> Option<&Field>

The original field (with metadata, e.g. extension names) of the positional argument at pos, if present.

source
pub fn const_bool(&self, pos: usize) -> Option<bool>

Read a const bool.

source
pub fn const_bytes(&self, pos: usize) -> Option<Vec<u8>>

Read const binary bytes.

source
pub fn const_f64(&self, pos: usize) -> Option<f64>

Read a const float (any float/int widened to f64).

source
pub fn const_i64(&self, pos: usize) -> Option<i64>

Read a const int (any integer type widened to i64).

source
pub fn const_str(&self, pos: usize) -> Option<String>

Read a const string.

source
pub fn named(&self, name: &str) -> Option<&ArrayRef>

The 1-row array of a named argument (non-null), if present. Lets callers read types without a dedicated accessor (e.g. INTERVAL month_day_nano).

source
pub fn named_bool(&self, name: &str) -> Option<bool>

Read a named const bool argument.

source
pub fn named_f64(&self, name: &str) -> Option<f64>

Read a named const float argument.

source
pub fn named_i64(&self, name: &str) -> Option<i64>

Read a named const int argument.

source
pub fn named_str(&self, name: &str) -> Option<String>

Read a named const string argument.

source
pub fn num_positional(&self) -> usize

Number of positional arguments.

source
pub fn parse(bytes: &[u8]) -> Result<Arguments>

Parse the IPC-serialized arguments blob. Empty input → no arguments.

source
pub fn remap_positional(&mut self, specs: &[crate::function::ArgSpec])

Expand compacted const-only positional args to their declared positions DuckDB sends only the const values, indexed in send order; this maps them back onto the declared positions.

source
pub fn serialize_positional(values: &[ArrayRef]) -> Result<Vec<u8>>

Serialize positional const arguments into the wire arguments blob (an IPC batch with a single args struct column whose fields are positional_0, positional_1, …). Inverse of [Arguments::parse].

source
pub fn serialize_scan_args(values: &[ArrayRef]) -> Result<Vec<u8>>

Serialize positional scan arguments in the catalog ScanFunctionResult format: a flat IPC batch with columns arg_0, arg_1, … (NOT the args struct used for direct calls).

source
pub fn serialize_scan_args_named(
positional: &[ArrayRef],
named: &[(&str, ArrayRef)],
) -> Result<Vec<u8>>

Serialize positional (arg_<i>) plus named (bare-name) scan arguments into the flat ScanFunctionResult.arguments batch.

source
pub fn resolve_overload<F>(
count: usize,
specs_of: F,
args: &Arguments,
input_schema: Option<&SchemaRef>,
) -> Option<usize>
where
F: Fn(usize) -> Vec<ArgSpec>,

Description

Resolve the best candidate index, or None if none are compatible.

source
pub fn resolve_overload_blended<F, B>(
count: usize,
specs_of: F,
blended_of: B,
args: &Arguments,
input_schema: Option<&SchemaRef>,
) -> Option<usize>
where
F: Fn(usize) -> Vec<ArgSpec>,
B: Fn(usize) -> bool,

Description

[resolve_overload] with a per-candidate blended (input_from_args) flag.

A blended candidate’s positional args ARE the per-row input columns — they are NOT on the wire (args.positional is empty in every call shape), so it resolves by INPUT-COLUMN count against the declared positional arity (geo_encode(52,13) → the 2-positional overload, geo_encode(52,13,100) → the 3-positional one; varargs matches any input-column count >= the fixed positional count) and disambiguates same-arity overloads by scoring the declared positional types against the input schema’s column types.