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


##########
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:
   I know this is not a concern of this PR, but looks as if this naming 
convention should be formalized/centralized somewhere (at least a constant), 
since otherwise there's a whole lot of `"item"` literals throughout the code.



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