Jefffrey commented on code in PR #24345:
URL: https://github.com/apache/datafusion/pull/24345#discussion_r3781792715


##########
datafusion/functions-nested/src/extract.rs:
##########
@@ -622,6 +621,15 @@ where
     let values = array.values();
     let original_data = values.to_data();
     let capacity = Capacities::Array(original_data.len());
+    // Carry the input's list field through to the output so that the returned
+    // type matches the one promised by `return_type` / 
`return_field_from_args`,
+    // including the field name, nullability and metadata.
+    let field = match array.data_type() {
+        List(field) | LargeList(field) => Arc::clone(field),
+        other => {
+            return internal_err!("array_slice got unexpected data type: 
{other}");

Review Comment:
   im having trouble understanding this comment; is it suggesting the view 
version was also incorrect? from what i can tell it is fine, its just the 
non-view (here) had the bug



##########
datafusion/functions-nested/src/extract.rs:
##########
@@ -622,6 +621,15 @@ where
     let values = array.values();
     let original_data = values.to_data();
     let capacity = Capacities::Array(original_data.len());
+    // Carry the input's list field through to the output so that the returned
+    // type matches the one promised by `return_type` / 
`return_field_from_args`,
+    // including the field name, nullability and metadata.
+    let field = match array.data_type() {
+        List(field) | LargeList(field) => Arc::clone(field),
+        other => {
+            return internal_err!("array_slice got unexpected data type: 
{other}");
+        }
+    };
 
     let mut mutable =
         MutableArrayData::with_capacities(vec![&original_data], true, 
capacity);

Review Comment:
   +1 on this
   
   (also can fix it on the view function too)



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