alamb commented on code in PR #9222:
URL: https://github.com/apache/arrow-datafusion/pull/9222#discussion_r1489305279


##########
datafusion/functions-array/src/make_array.rs:
##########
@@ -0,0 +1,311 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! implementation of make_array function
+
+use arrow::array::{
+    new_null_array, Array, ArrayData, ArrayRef, Capacities, GenericListArray,
+    MutableArrayData, NullArray, OffsetSizeTrait,
+};
+use arrow::buffer::OffsetBuffer;
+use arrow::datatypes::{DataType, Field};
+use datafusion_common::utils::array_into_list_array;
+use datafusion_common::{plan_err, DataFusionError, Result};
+use datafusion_expr::{
+    ColumnarValue, Expr, ScalarUDFImpl, Signature, TypeSignature, Volatility,
+};
+use std::any::Any;
+use std::sync::Arc;
+
+// Create static instances of ScalarUDFs for each function
+make_udf_function!(
+    MakeArray,
+    make_array,
+    array,
+    "returns an Arrow array using the specified input expressions.",
+    udf

Review Comment:
   I struggled to come up with a good name. The macro is basically creating two 
functions
   
   ```rust
   /// fluent expr style
   fn make_array(array: Expr) -> Expr {
   }
   
   /// return a ScalarUDF
   fn udf() -> ScalarUdf { 
   ...
   }
   ```
   
   The udf one is used to register the function:
   ```rust
   /// Registers all enabled packages with a [`FunctionRegistry`]
   pub fn register_all(registry: &mut dyn FunctionRegistry) -> Result<()> {
       let functions: Vec<Arc<ScalarUDF>> = vec![
           to_string::udf(),
           make_array::udf(),
           set_ops::union_udf(),
           set_ops::intersect_udf(),
           set_ops::distinct_udf(),
       ];
   ```
   
   So it can't be the expr_fn name , but `udf` is also pretty generic 🤔 



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