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


##########
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:
   I think we dont need this. I play around it and find that there is error in 
   
   
https://github.com/apache/arrow-datafusion/blob/32d906fc9622af3a67b3828700272092fe0982a0/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs#L526-L530
   
   LargeList casting panics
   
   If the list casting is fixed, probably we dont need 
`make_scalar_function_with_hints` anymore.



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