Skip to main content

FunctionRegistry

Struct FunctionRegistry 

Source
pub struct FunctionRegistry { /* private fields */ }
Expand description

Registry for scalar, aggregate, and window functions, keyed by (name, num_args).

Lookup strategy (§9.5):

  1. Exact match on (UPPERCASE_NAME, num_args).
  2. Fallback to variadic version (UPPERCASE_NAME, -1).
  3. None if neither found (caller should raise “no such function”).

Implementations§

Source§

impl FunctionRegistry

Source

pub fn new() -> Self

Create an empty registry.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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).

Source

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).

Source

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).

Source

pub fn contains_scalar(&self, name: &str) -> bool

Whether the registry contains any scalar function with this name (any arg count).

Source

pub fn contains_aggregate(&self, name: &str) -> bool

Whether the registry contains any aggregate function with this name (any arg count).

Source

pub fn contains_window(&self, name: &str) -> bool

Whether the registry contains any window function with this name (any arg count).

Source

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.

Trait Implementations§

Source§

impl Default for FunctionRegistry

Source§

fn default() -> FunctionRegistry

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more