jonahgao commented on code in PR #13674: URL: https://github.com/apache/datafusion/pull/13674#discussion_r1872682452
########## datafusion/functions/src/macros.rs: ########## @@ -71,20 +71,18 @@ macro_rules! export_functions { /// This is used to ensure creating the list of `ScalarUDF` only happens once. macro_rules! make_udf_function { ($UDF:ty, $GNAME:ident, $NAME:ident) => { - /// Singleton instance of the function - static $GNAME: std::sync::OnceLock<std::sync::Arc<datafusion_expr::ScalarUDF>> = - std::sync::OnceLock::new(); - #[doc = "Return a [`ScalarUDF`](datafusion_expr::ScalarUDF) implementation "] #[doc = stringify!($UDF)] pub fn $NAME() -> std::sync::Arc<datafusion_expr::ScalarUDF> { - $GNAME - .get_or_init(|| { - std::sync::Arc::new(datafusion_expr::ScalarUDF::new_from_impl( - <$UDF>::new(), - )) - }) - .clone() + /// Singleton instance of the function + static $GNAME: std::sync::LazyLock< Review Comment: ` $GNAME` can be removed, maybe in a follow-up PR. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org