pub trait FunctionRegistry {
    // Required methods
    fn udfs(&self) -> HashSet<String>;
    fn udf(&self, name: &str) -> Result<Arc<ScalarUDF>, DataFusionError>;
    fn udaf(&self, name: &str) -> Result<Arc<AggregateUDF>, DataFusionError>;
    fn udwf(&self, name: &str) -> Result<Arc<WindowUDF>, DataFusionError>;

    // Provided methods
    fn register_udf(
        &mut self,
        _udf: Arc<ScalarUDF>
    ) -> Result<Option<Arc<ScalarUDF>>, DataFusionError> { ... }
    fn register_udaf(
        &mut self,
        _udaf: Arc<AggregateUDF>
    ) -> Result<Option<Arc<AggregateUDF>>, DataFusionError> { ... }
    fn register_udwf(
        &mut self,
        _udaf: Arc<WindowUDF>
    ) -> Result<Option<Arc<WindowUDF>>, DataFusionError> { ... }
    fn deregister_udf(
        &mut self,
        _name: &str
    ) -> Result<Option<Arc<ScalarUDF>>, DataFusionError> { ... }
    fn deregister_udaf(
        &mut self,
        _name: &str
    ) -> Result<Option<Arc<AggregateUDF>>, DataFusionError> { ... }
    fn deregister_udwf(
        &mut self,
        _name: &str
    ) -> Result<Option<Arc<WindowUDF>>, DataFusionError> { ... }
    fn register_function_rewrite(
        &mut self,
        _rewrite: Arc<dyn FunctionRewrite + Sync + Send>
    ) -> Result<(), DataFusionError> { ... }
}
Expand description

A registry knows how to build logical expressions out of user-defined function’ names

Required Methods§

source

fn udfs(&self) -> HashSet<String>

Set of all available udfs.

source

fn udf(&self, name: &str) -> Result<Arc<ScalarUDF>, DataFusionError>

Returns a reference to the user defined scalar function (udf) named name.

source

fn udaf(&self, name: &str) -> Result<Arc<AggregateUDF>, DataFusionError>

Returns a reference to the user defined aggregate function (udaf) named name.

source

fn udwf(&self, name: &str) -> Result<Arc<WindowUDF>, DataFusionError>

Returns a reference to the user defined window function (udwf) named name.

Provided Methods§

source

fn register_udf( &mut self, _udf: Arc<ScalarUDF> ) -> Result<Option<Arc<ScalarUDF>>, DataFusionError>

Registers a new ScalarUDF, returning any previously registered implementation.

Returns an error (the default) if the function can not be registered, for example if the registry is read only.

source

fn register_udaf( &mut self, _udaf: Arc<AggregateUDF> ) -> Result<Option<Arc<AggregateUDF>>, DataFusionError>

Registers a new AggregateUDF, returning any previously registered implementation.

Returns an error (the default) if the function can not be registered, for example if the registry is read only.

source

fn register_udwf( &mut self, _udaf: Arc<WindowUDF> ) -> Result<Option<Arc<WindowUDF>>, DataFusionError>

Registers a new WindowUDF, returning any previously registered implementation.

Returns an error (the default) if the function can not be registered, for example if the registry is read only.

source

fn deregister_udf( &mut self, _name: &str ) -> Result<Option<Arc<ScalarUDF>>, DataFusionError>

Deregisters a ScalarUDF, returning the implementation that was deregistered.

Returns an error (the default) if the function can not be deregistered, for example if the registry is read only.

source

fn deregister_udaf( &mut self, _name: &str ) -> Result<Option<Arc<AggregateUDF>>, DataFusionError>

Deregisters a AggregateUDF, returning the implementation that was deregistered.

Returns an error (the default) if the function can not be deregistered, for example if the registry is read only.

source

fn deregister_udwf( &mut self, _name: &str ) -> Result<Option<Arc<WindowUDF>>, DataFusionError>

Deregisters a WindowUDF, returning the implementation that was deregistered.

Returns an error (the default) if the function can not be deregistered, for example if the registry is read only.

source

fn register_function_rewrite( &mut self, _rewrite: Arc<dyn FunctionRewrite + Sync + Send> ) -> Result<(), DataFusionError>

Registers a new FunctionRewrite with the registry.

FunctionRewrite rules are used to rewrite certain / operators in the logical plan to function calls. For example a || b might be written to array_concat(a, b).

This allows the behavior of operators to be customized by the user.

Implementors§