jayzhan211 commented on code in PR #9980:
URL: https://github.com/apache/arrow-datafusion/pull/9980#discussion_r1554812821
##########
datafusion/functions-array/src/lib.rs:
##########
@@ -98,54 +103,245 @@ pub mod expr_fn {
pub use super::string::string_to_array;
}
+
+
+pub type ScalarFactory = Box<dyn Fn() -> Arc<ScalarUDF> + Send + Sync>;
+
+/// HashMap Singleton for UDFs
+///
+/// Replace register_all with our built-in functions
+/// Replace scalar_functions: HashMap<String, Arc<ScalarUDF>> in SessionState
+pub fn array_functions() -> &'static Mutex<HashMap<String, ScalarFactory>> {
+ static FUNCTIONS: OnceLock<Mutex<HashMap<String, ScalarFactory>>> =
OnceLock::new();
+ FUNCTIONS.get_or_init(|| {
+ let mut functions = HashMap::new();
+ functions.insert(
+ String::from("array_to_string"),
Review Comment:
This commit can run, the next step is to make the `alias` public, so we can
easily create a function here.
@alamb
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]