tustvold commented on code in PR #7366:
URL: https://github.com/apache/arrow-rs/pull/7366#discussion_r2026982246


##########
arrow-array/src/array/struct_array.rs:
##########
@@ -294,10 +294,34 @@ impl StructArray {
 
 impl From<ArrayData> for StructArray {
     fn from(data: ArrayData) -> Self {
+        let parent_offset = data.offset();
+        let parent_len = data.len();
+
         let fields = data
             .child_data()
             .iter()
-            .map(|cd| make_array(cd.clone()))
+            .map(|cd| {
+                let child_offset = cd.offset();

Review Comment:
   Rather than this somewhat opaque logic, which I am also not sure is correct 
w.r.t nulls, I wonder if we could just do something along these lines
   
   ```
   let child = make_array(cd.clone());
   if (parent_offset != 0 || parent_len != cd .len()) {
       return child.slice(parent_offset, parent_len);
   }
   return child
   ```



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