pub trait FunctionRegistry {
Show 13 methods
// 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>;
fn expr_planners(&self) -> Vec<Arc<dyn ExprPlanner>>;
// 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> { ... }
fn register_expr_planner(
&mut self,
_expr_planner: Arc<dyn ExprPlanner>,
) -> Result<(), DataFusionError> { ... }
}
Expand description
A registry knows how to build logical expressions out of user-defined function’ names
Required Methods§
Sourcefn udf(&self, name: &str) -> Result<Arc<ScalarUDF>, DataFusionError>
fn udf(&self, name: &str) -> Result<Arc<ScalarUDF>, DataFusionError>
Returns a reference to the user defined scalar function (udf) named
name
.
Sourcefn udaf(&self, name: &str) -> Result<Arc<AggregateUDF>, DataFusionError>
fn udaf(&self, name: &str) -> Result<Arc<AggregateUDF>, DataFusionError>
Returns a reference to the user defined aggregate function (udaf) named
name
.
Sourcefn udwf(&self, name: &str) -> Result<Arc<WindowUDF>, DataFusionError>
fn udwf(&self, name: &str) -> Result<Arc<WindowUDF>, DataFusionError>
Returns a reference to the user defined window function (udwf) named
name
.
Sourcefn expr_planners(&self) -> Vec<Arc<dyn ExprPlanner>>
fn expr_planners(&self) -> Vec<Arc<dyn ExprPlanner>>
Set of all registered ExprPlanner
s
Provided Methods§
Sourcefn register_udf(
&mut self,
_udf: Arc<ScalarUDF>,
) -> Result<Option<Arc<ScalarUDF>>, DataFusionError>
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.
Sourcefn register_udaf(
&mut self,
_udaf: Arc<AggregateUDF>,
) -> Result<Option<Arc<AggregateUDF>>, DataFusionError>
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.
Sourcefn register_udwf(
&mut self,
_udaf: Arc<WindowUDF>,
) -> Result<Option<Arc<WindowUDF>>, DataFusionError>
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.
Sourcefn deregister_udf(
&mut self,
_name: &str,
) -> Result<Option<Arc<ScalarUDF>>, DataFusionError>
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.
Sourcefn deregister_udaf(
&mut self,
_name: &str,
) -> Result<Option<Arc<AggregateUDF>>, DataFusionError>
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.
Sourcefn deregister_udwf(
&mut self,
_name: &str,
) -> Result<Option<Arc<WindowUDF>>, DataFusionError>
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.
Sourcefn register_function_rewrite(
&mut self,
_rewrite: Arc<dyn FunctionRewrite + Sync + Send>,
) -> Result<(), DataFusionError>
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.
Sourcefn register_expr_planner(
&mut self,
_expr_planner: Arc<dyn ExprPlanner>,
) -> Result<(), DataFusionError>
fn register_expr_planner( &mut self, _expr_planner: Arc<dyn ExprPlanner>, ) -> Result<(), DataFusionError>
Registers a new ExprPlanner
with the registry.