alamb commented on code in PR #13468:
URL: https://github.com/apache/datafusion/pull/13468#discussion_r1849062035


##########
datafusion/common/src/utils/mod.rs:
##########
@@ -324,18 +324,29 @@ pub fn longest_consecutive_prefix<T: Borrow<usize>>(
 /// Wrap an array into a single element `ListArray`.
 /// For example `[1, 2, 3]` would be converted into `[[1, 2, 3]]`
 /// The field in the list array is nullable.
-pub fn array_into_list_array_nullable(arr: ArrayRef) -> ListArray {
-    array_into_list_array(arr, true)
+pub fn array_into_list_array_nullable(
+    arr: ArrayRef,
+    field_name: Option<&str>,
+) -> ListArray {
+    array_into_list_array(arr, true, field_name)
 }
 
 /// Array Utils
 
 /// Wrap an array into a single element `ListArray`.
 /// For example `[1, 2, 3]` would be converted into `[[1, 2, 3]]`
-pub fn array_into_list_array(arr: ArrayRef, nullable: bool) -> ListArray {
+pub fn array_into_list_array(
+    arr: ArrayRef,
+    nullable: bool,
+    field_name: Option<&str>,
+) -> ListArray {
     let offsets = OffsetBuffer::from_lengths([arr.len()]);
     ListArray::new(
-        Arc::new(Field::new_list_field(arr.data_type().to_owned(), nullable)),
+        Arc::new(Field::new(
+            field_name.unwrap_or("item"),

Review Comment:
   100% agree -- I think it should be done in arrow-rs
   
   Maybe we could add some comments on 
https://docs.rs/arrow/latest/arrow/datatypes/struct.Field.html#method.new_list 
or something



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

Reply via email to