VTable

Trait VTable 

Source
pub trait VTable:
    'static
    + Send
    + Sync
    + Sized {
    type Options: 'static + Send + Sync + Clone + PartialEq + Eq + Hash + Debug + Display;

    // Required methods
    fn id(&self) -> FunctionId;
    fn arity(&self, options: &Self::Options) -> Arity;
    fn arg_name(&self, options: &Self::Options, arg_idx: usize) -> ArgName;
    fn return_dtype(
        &self,
        options: &Self::Options,
        arg_types: &[DType],
    ) -> VortexResult<DType>;
    fn execute(
        &self,
        _options: &Self::Options,
        _args: &ExecutionArgs,
    ) -> VortexResult<Datum>;

    // Provided methods
    fn serialize(
        &self,
        _options: &Self::Options,
    ) -> VortexResult<Option<Vec<u8>>> { ... }
    fn deserialize(&self, _bytes: &[u8]) -> VortexResult<Self::Options> { ... }
    fn null_handling(&self, options: &Self::Options) -> NullHandling { ... }
    fn stat_falsification(
        &self,
        options: &Self::Options,
        expr: &Expression,
        catalog: &dyn StatsCatalog,
    ) -> Option<Expression> { ... }
    fn stat_expression(
        &self,
        options: &Self::Options,
        expr: &Expression,
        stat: Stat,
        catalog: &dyn StatsCatalog,
    ) -> Option<Expression> { ... }
}
Expand description

A non-object-safe vtable trait for scalar function types.

This trait should be implemented in order to define new scalar functions within Vortex.

Required Associated Types§

Source

type Options: 'static + Send + Sync + Clone + PartialEq + Eq + Hash + Debug + Display

Any options for configuring the function’s behaviour.

Required Methods§

Source

fn id(&self) -> FunctionId

The globally unique identifier for this function.

Source

fn arity(&self, options: &Self::Options) -> Arity

Returns the arity (number of arguments) for this function.

Source

fn arg_name(&self, options: &Self::Options, arg_idx: usize) -> ArgName

Returns the display name of the nth argument for this function.

Source

fn return_dtype( &self, options: &Self::Options, arg_types: &[DType], ) -> VortexResult<DType>

Computes the return DType given the argument types and function options.

Source

fn execute( &self, _options: &Self::Options, _args: &ExecutionArgs, ) -> VortexResult<Datum>

Binds the function for execution over a specific set of inputs.

Provided Methods§

Source

fn serialize(&self, _options: &Self::Options) -> VortexResult<Option<Vec<u8>>>

Serializes the options for a function instance.

Source

fn deserialize(&self, _bytes: &[u8]) -> VortexResult<Self::Options>

Deserializes the options for this function from a byte slice.

Source

fn null_handling(&self, options: &Self::Options) -> NullHandling

How the function behaves when one or more arguments are NULL.

Most functions propagate NULL (any NULL argument produces NULL output). Some functions have special NULL handling that can short-circuit evaluation or treat NULL as a meaningful value.

Required for correct NULL semantics; may also enable optimizations when argument nullability is known from schema or statistics.

Source

fn stat_falsification( &self, options: &Self::Options, expr: &Expression, catalog: &dyn StatsCatalog, ) -> Option<Expression>

See Expression::stat_falsification

Note that the falsification API will change in the future to instead use a falsify expression along with push-down rules.

Source

fn stat_expression( &self, options: &Self::Options, expr: &Expression, stat: Stat, catalog: &dyn StatsCatalog, ) -> Option<Expression>

See Expression::stat_expression

Note that the stat_expression API will change in the future such that layouts with pruning capabilities perform their own mapping over statistics.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§