pub struct FunctionRegistry { /* private fields */ }Expand description
Registry for scalar, aggregate, and window functions, keyed by
(name, num_args).
Lookup strategy (§9.5):
- Exact match on
(UPPERCASE_NAME, num_args). - Fallback to variadic version
(UPPERCASE_NAME, -1). Noneif neither found (caller should raise “no such function”).
Implementations§
Source§impl FunctionRegistry
impl FunctionRegistry
Sourcepub fn clone_from_arc(arc: &Arc<Self>) -> Self
pub fn clone_from_arc(arc: &Arc<Self>) -> Self
Create a mutable clone of a registry from an Arc reference.
This is used by the UDF registration API to produce a new registry containing the existing functions plus the newly registered UDF.
Sourcepub fn register_scalar<F>(
&mut self,
function: F,
) -> Option<Arc<dyn ScalarFunction>>where
F: ScalarFunction + 'static,
pub fn register_scalar<F>(
&mut self,
function: F,
) -> Option<Arc<dyn ScalarFunction>>where
F: ScalarFunction + 'static,
Register a scalar function, keyed by (name, num_args).
Overwrites any existing function with the same key. Returns the previous function if one existed.
Sourcepub fn register_aggregate<F>(
&mut self,
function: F,
) -> Option<Arc<ErasedAggregateFunction>>where
F: AggregateFunction + 'static,
F::State: 'static,
pub fn register_aggregate<F>(
&mut self,
function: F,
) -> Option<Arc<ErasedAggregateFunction>>where
F: AggregateFunction + 'static,
F::State: 'static,
Register an aggregate function using the type-erased adapter.
Overwrites any existing function with the same (name, num_args) key.
Sourcepub fn register_window<F>(
&mut self,
function: F,
) -> Option<Arc<ErasedWindowFunction>>where
F: WindowFunction + 'static,
F::State: 'static,
pub fn register_window<F>(
&mut self,
function: F,
) -> Option<Arc<ErasedWindowFunction>>where
F: WindowFunction + 'static,
F::State: 'static,
Register a window function using the type-erased adapter.
Overwrites any existing function with the same (name, num_args) key.
Sourcepub fn find_scalar(
&self,
name: &str,
num_args: i32,
) -> Option<Arc<dyn ScalarFunction>>
pub fn find_scalar( &self, name: &str, num_args: i32, ) -> Option<Arc<dyn ScalarFunction>>
Look up a scalar function by (name, num_args).
Tries exact match first, then falls back to the variadic version
(name, -1) if no exact match exists.
Sourcepub fn find_scalar_precanonical(
&self,
canonical: &str,
num_args: i32,
) -> Option<Arc<dyn ScalarFunction>>
pub fn find_scalar_precanonical( &self, canonical: &str, num_args: i32, ) -> Option<Arc<dyn ScalarFunction>>
Look up a scalar function by already-uppercased name (avoids allocation).
Used by the VDBE engine where P4::FuncName values are already
canonicalized by codegen.
Sourcepub fn find_aggregate(
&self,
name: &str,
num_args: i32,
) -> Option<Arc<ErasedAggregateFunction>>
pub fn find_aggregate( &self, name: &str, num_args: i32, ) -> Option<Arc<ErasedAggregateFunction>>
Look up an aggregate function by (name, num_args).
Tries exact match first, then falls back to variadic (name, -1).
Sourcepub fn find_aggregate_precanonical(
&self,
canonical: &str,
num_args: i32,
) -> Option<Arc<ErasedAggregateFunction>>
pub fn find_aggregate_precanonical( &self, canonical: &str, num_args: i32, ) -> Option<Arc<ErasedAggregateFunction>>
Look up an aggregate function by already-uppercased name (avoids allocation).
Sourcepub fn find_window(
&self,
name: &str,
num_args: i32,
) -> Option<Arc<ErasedWindowFunction>>
pub fn find_window( &self, name: &str, num_args: i32, ) -> Option<Arc<ErasedWindowFunction>>
Look up a window function by (name, num_args).
Tries exact match first, then falls back to variadic (name, -1).
Sourcepub fn contains_scalar(&self, name: &str) -> bool
pub fn contains_scalar(&self, name: &str) -> bool
Whether the registry contains any scalar function with this name (any arg count).
Sourcepub fn contains_aggregate(&self, name: &str) -> bool
pub fn contains_aggregate(&self, name: &str) -> bool
Whether the registry contains any aggregate function with this name (any arg count).
Sourcepub fn contains_window(&self, name: &str) -> bool
pub fn contains_window(&self, name: &str) -> bool
Whether the registry contains any window function with this name (any arg count).
Sourcepub fn aggregate_names_lowercase(&self) -> Vec<String>
pub fn aggregate_names_lowercase(&self) -> Vec<String>
Return deduplicated lowercase names of all registered aggregate functions.
Used by the codegen thread-local to recognize custom aggregate UDFs.