guojidan commented on code in PR #9343:
URL: https://github.com/apache/arrow-datafusion/pull/9343#discussion_r1505708694


##########
datafusion/functions-array/src/udf.rs:
##########
@@ -75,8 +116,233 @@ impl ScalarUDFImpl for ArrayToString {
     }
 
     fn invoke(&self, args: &[ColumnarValue]) -> 
datafusion_common::Result<ColumnarValue> {
-        let args = ColumnarValue::values_to_arrays(args)?;
-        crate::kernels::array_to_string(&args).map(ColumnarValue::Array)
+        make_scalar_function_with_hints(crate::kernels::array_to_string)(args)
+    }
+
+    fn aliases(&self) -> &[String] {
+        &self.aliases
+    }
+}
+
+#[derive(Debug)]
+pub(super) struct ArrayAppend {
+    signature: Signature,
+    aliases: Vec<String>,
+}
+
+impl ArrayAppend {
+    pub fn new() -> Self {
+        Self {
+            signature: Signature::array_and_element(Volatility::Immutable),
+            aliases: vec![
+                String::from("array_append"),
+                String::from("list_append"),
+                String::from("array_push_back"),
+                String::from("list_push_back"),
+            ],
+        }
+    }
+}
+
+impl ScalarUDFImpl for ArrayAppend {
+    fn as_any(&self) -> &dyn Any {
+        self
+    }
+
+    fn name(&self) -> &str {
+        "array_append"
+    }
+
+    fn signature(&self) -> &Signature {
+        &self.signature
+    }
+
+    fn return_type(&self, arg_types: &[DataType]) -> 
datafusion_common::Result<DataType> {
+        Ok(arg_types[0].clone())
+    }
+
+    fn invoke(&self, args: &[ColumnarValue]) -> 
datafusion_common::Result<ColumnarValue> {
+        make_scalar_function_with_hints(crate::kernels::array_append)(args)

Review Comment:
   but I think `make_scalar_function_with_hints` function have clear logic, 
determine output is Scalar or Array, I want 
    to keep it 🤔 



-- 
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]

Reply via email to