adriangb commented on code in PR #21984:
URL: https://github.com/apache/datafusion/pull/21984#discussion_r3250776729


##########
datafusion/functions-nested/src/arrays_zip.rs:
##########
@@ -315,15 +361,60 @@ fn arrays_zip_inner(args: &[ArrayRef]) -> 
Result<ArrayRef> {
 
     let null_buffer = null_builder.finish();
 
-    let result = ListArray::try_new(
+    let list_inner = inner_field.unwrap_or_else(|| {
         Arc::new(Field::new_list_field(
             struct_array.data_type().clone(),
             true,
-        )),
+        ))
+    });
+    let result = ListArray::try_new(
+        list_inner,
         OffsetBuffer::new(offsets.into()),
         Arc::new(struct_array),
         null_buffer,
     )?;
 
     Ok(Arc::new(result))
 }
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use std::collections::HashMap;
+
+    /// Regression test for #21982: `arrays_zip` must propagate each input
+    /// list's element-field metadata onto the corresponding struct member.
+    #[test]
+    fn arrays_zip_preserves_struct_member_metadata() -> Result<()> {
+        let with_meta = |k: &str, v: &str, dt: DataType| -> FieldRef {
+            let metadata = HashMap::from([(k.to_string(), v.to_string())]);
+            Arc::new(Field::new("e", dt, true).with_metadata(metadata))
+        };
+        let a_inner = with_meta("ARROW:extension:name", "arrow.uuid", 
DataType::Int64);
+        let b_inner = with_meta("ARROW:extension:name", "arrow.json", 
DataType::Utf8);

Review Comment:
   Replaced with arbitrary metadata



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to