Trait datafusion_expr::registry::FunctionRegistry
source · pub trait FunctionRegistry {
Show 13 methods
// Required methods
fn udfs(&self) -> HashSet<String>;
fn udf(&self, name: &str) -> Result<Arc<ScalarUDF>>;
fn udaf(&self, name: &str) -> Result<Arc<AggregateUDF>>;
fn udwf(&self, name: &str) -> Result<Arc<WindowUDF>>;
fn expr_planners(&self) -> Vec<Arc<dyn ExprPlanner>>;
// Provided methods
fn register_udf(
&mut self,
_udf: Arc<ScalarUDF>,
) -> Result<Option<Arc<ScalarUDF>>> { ... }
fn register_udaf(
&mut self,
_udaf: Arc<AggregateUDF>,
) -> Result<Option<Arc<AggregateUDF>>> { ... }
fn register_udwf(
&mut self,
_udaf: Arc<WindowUDF>,
) -> Result<Option<Arc<WindowUDF>>> { ... }
fn deregister_udf(&mut self, _name: &str) -> Result<Option<Arc<ScalarUDF>>> { ... }
fn deregister_udaf(
&mut self,
_name: &str,
) -> Result<Option<Arc<AggregateUDF>>> { ... }
fn deregister_udwf(&mut self, _name: &str) -> Result<Option<Arc<WindowUDF>>> { ... }
fn register_function_rewrite(
&mut self,
_rewrite: Arc<dyn FunctionRewrite + Send + Sync>,
) -> Result<()> { ... }
fn register_expr_planner(
&mut self,
_expr_planner: Arc<dyn ExprPlanner>,
) -> Result<()> { ... }
}
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>>
fn udf(&self, name: &str) -> Result<Arc<ScalarUDF>>
Returns a reference to the user defined scalar function (udf) named
name
.
sourcefn udaf(&self, name: &str) -> Result<Arc<AggregateUDF>>
fn udaf(&self, name: &str) -> Result<Arc<AggregateUDF>>
Returns a reference to the user defined aggregate function (udaf) named
name
.
sourcefn udwf(&self, name: &str) -> Result<Arc<WindowUDF>>
fn udwf(&self, name: &str) -> Result<Arc<WindowUDF>>
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>>>
fn register_udf( &mut self, _udf: Arc<ScalarUDF>, ) -> Result<Option<Arc<ScalarUDF>>>
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>>>
fn register_udaf( &mut self, _udaf: Arc<AggregateUDF>, ) -> Result<Option<Arc<AggregateUDF>>>
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>>>
fn register_udwf( &mut self, _udaf: Arc<WindowUDF>, ) -> Result<Option<Arc<WindowUDF>>>
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>>>
fn deregister_udf(&mut self, _name: &str) -> Result<Option<Arc<ScalarUDF>>>
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>>>
fn deregister_udaf(&mut self, _name: &str) -> Result<Option<Arc<AggregateUDF>>>
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>>>
fn deregister_udwf(&mut self, _name: &str) -> Result<Option<Arc<WindowUDF>>>
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 + Send + Sync>,
) -> Result<()>
fn register_function_rewrite( &mut self, _rewrite: Arc<dyn FunctionRewrite + Send + Sync>, ) -> Result<()>
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<()>
fn register_expr_planner( &mut self, _expr_planner: Arc<dyn ExprPlanner>, ) -> Result<()>
Registers a new ExprPlanner
with the registry.