macro_rules! make_udf_expr_and_func {
($UDF:ident, $EXPR_FN:ident, $($arg:ident)*, $DOC:expr, $SCALAR_UDF_FN:ident) => { ... };
($UDF:ident, $EXPR_FN:ident, $($arg:ident)*, $DOC:expr, $SCALAR_UDF_FN:ident, $CTOR:path) => { ... };
($UDF:ident, $EXPR_FN:ident, $DOC:expr, $SCALAR_UDF_FN:ident) => { ... };
($UDF:ident, $EXPR_FN:ident, $DOC:expr, $SCALAR_UDF_FN:ident, $CTOR:path) => { ... };
}Expand description
Creates external API functions for an array UDF. Specifically, creates
- Single
ScalarUDFinstance
Creates a singleton ScalarUDF of the $UDF function named STATIC_$(UDF) and a
function named $SCALAR_UDF_FUNC which returns that function named STATIC_$(UDF).
This is used to ensure creating the list of ScalarUDF only happens once.
§2. expr_fn style function
These are functions that create an Expr that invokes the UDF, used
primarily to programmatically create expressions.
For example:
pub fn array_to_string(delimiter: Expr) -> Expr {
...
}§Arguments
UDF: name of theScalarUDFImplEXPR_FN: name of the expr_fn function to be createdarg: 0 or more named arguments for the functionDOC: documentation string for the functionSCALAR_UDF_FUNC: name of the function to create (just) theScalarUDF- (optional)
$CTOR: Pass a custom constructor. When omitted it automatically resolves to$UDF::new().