@@ -65,24 +65,23 @@ macro_rules! export_functions {
65
65
} ;
66
66
}
67
67
68
- /// Creates a singleton `ScalarUDF` of the `$UDF` function named `$GNAME` and a
69
- /// function named `$NAME` which returns that singleton.
68
+ /// Creates a singleton `ScalarUDF` of the `$UDF` function and a function
69
+ /// named `$NAME` which returns that singleton.
70
70
///
71
71
/// This is used to ensure creating the list of `ScalarUDF` only happens once.
72
72
macro_rules! make_udf_function {
73
- ( $UDF: ty, $GNAME: ident, $NAME: ident) => {
74
- #[ doc = "Return a [`ScalarUDF`](datafusion_expr::ScalarUDF) implementation " ]
75
- #[ doc = stringify!( $UDF) ]
73
+ ( $UDF: ty, $NAME: ident) => {
74
+ #[ doc = concat!( "Return a [`ScalarUDF`](datafusion_expr::ScalarUDF) implementation of " , stringify!( $NAME) ) ]
76
75
pub fn $NAME( ) -> std:: sync:: Arc <datafusion_expr:: ScalarUDF > {
77
76
// Singleton instance of the function
78
- static $GNAME : std:: sync:: LazyLock <
77
+ static INSTANCE : std:: sync:: LazyLock <
79
78
std:: sync:: Arc <datafusion_expr:: ScalarUDF >,
80
79
> = std:: sync:: LazyLock :: new( || {
81
80
std:: sync:: Arc :: new( datafusion_expr:: ScalarUDF :: new_from_impl(
82
81
<$UDF>:: new( ) ,
83
82
) )
84
83
} ) ;
85
- std:: sync:: Arc :: clone( & $GNAME )
84
+ std:: sync:: Arc :: clone( & INSTANCE )
86
85
}
87
86
} ;
88
87
}
@@ -134,13 +133,13 @@ macro_rules! downcast_arg {
134
133
/// applies a unary floating function to the argument, and returns a value of the same type.
135
134
///
136
135
/// $UDF: the name of the UDF struct that implements `ScalarUDFImpl`
137
- /// $GNAME: a singleton instance of the UDF
138
136
/// $NAME: the name of the function
139
137
/// $UNARY_FUNC: the unary function to apply to the argument
140
138
/// $OUTPUT_ORDERING: the output ordering calculation method of the function
139
+ /// $GET_DOC: the function to get the documentation of the UDF
141
140
macro_rules! make_math_unary_udf {
142
- ( $UDF: ident, $GNAME : ident , $ NAME: ident, $UNARY_FUNC: ident, $OUTPUT_ORDERING: expr, $EVALUATE_BOUNDS: expr, $GET_DOC: expr) => {
143
- make_udf_function!( $NAME:: $UDF, $GNAME , $ NAME) ;
141
+ ( $UDF: ident, $NAME: ident, $UNARY_FUNC: ident, $OUTPUT_ORDERING: expr, $EVALUATE_BOUNDS: expr, $GET_DOC: expr) => {
142
+ make_udf_function!( $NAME:: $UDF, $NAME) ;
144
143
145
144
mod $NAME {
146
145
use std:: any:: Any ;
@@ -248,13 +247,13 @@ macro_rules! make_math_unary_udf {
248
247
/// applies a binary floating function to the argument, and returns a value of the same type.
249
248
///
250
249
/// $UDF: the name of the UDF struct that implements `ScalarUDFImpl`
251
- /// $GNAME: a singleton instance of the UDF
252
250
/// $NAME: the name of the function
253
251
/// $BINARY_FUNC: the binary function to apply to the argument
254
252
/// $OUTPUT_ORDERING: the output ordering calculation method of the function
253
+ /// $GET_DOC: the function to get the documentation of the UDF
255
254
macro_rules! make_math_binary_udf {
256
- ( $UDF: ident, $GNAME : ident , $ NAME: ident, $BINARY_FUNC: ident, $OUTPUT_ORDERING: expr, $GET_DOC: expr) => {
257
- make_udf_function!( $NAME:: $UDF, $GNAME , $ NAME) ;
255
+ ( $UDF: ident, $NAME: ident, $BINARY_FUNC: ident, $OUTPUT_ORDERING: expr, $GET_DOC: expr) => {
256
+ make_udf_function!( $NAME:: $UDF, $NAME) ;
258
257
259
258
mod $NAME {
260
259
use std:: any:: Any ;
0 commit comments