@@ -65,24 +65,23 @@ macro_rules! export_functions {
6565 } ;
6666}
6767
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.
7070///
7171/// This is used to ensure creating the list of `ScalarUDF` only happens once.
7272macro_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) ) ]
7675 pub fn $NAME( ) -> std:: sync:: Arc <datafusion_expr:: ScalarUDF > {
7776 // Singleton instance of the function
78- static $GNAME : std:: sync:: LazyLock <
77+ static INSTANCE : std:: sync:: LazyLock <
7978 std:: sync:: Arc <datafusion_expr:: ScalarUDF >,
8079 > = std:: sync:: LazyLock :: new( || {
8180 std:: sync:: Arc :: new( datafusion_expr:: ScalarUDF :: new_from_impl(
8281 <$UDF>:: new( ) ,
8382 ) )
8483 } ) ;
85- std:: sync:: Arc :: clone( & $GNAME )
84+ std:: sync:: Arc :: clone( & INSTANCE )
8685 }
8786 } ;
8887}
@@ -134,13 +133,13 @@ macro_rules! downcast_arg {
134133/// applies a unary floating function to the argument, and returns a value of the same type.
135134///
136135/// $UDF: the name of the UDF struct that implements `ScalarUDFImpl`
137- /// $GNAME: a singleton instance of the UDF
138136/// $NAME: the name of the function
139137/// $UNARY_FUNC: the unary function to apply to the argument
140138/// $OUTPUT_ORDERING: the output ordering calculation method of the function
139+ /// $GET_DOC: the function to get the documentation of the UDF
141140macro_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) ;
144143
145144 mod $NAME {
146145 use std:: any:: Any ;
@@ -248,13 +247,13 @@ macro_rules! make_math_unary_udf {
248247/// applies a binary floating function to the argument, and returns a value of the same type.
249248///
250249/// $UDF: the name of the UDF struct that implements `ScalarUDFImpl`
251- /// $GNAME: a singleton instance of the UDF
252250/// $NAME: the name of the function
253251/// $BINARY_FUNC: the binary function to apply to the argument
254252/// $OUTPUT_ORDERING: the output ordering calculation method of the function
253+ /// $GET_DOC: the function to get the documentation of the UDF
255254macro_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) ;
258257
259258 mod $NAME {
260259 use std:: any:: Any ;
0 commit comments