mapleFU commented on code in PR #8694:
URL: https://github.com/apache/arrow-rs/pull/8694#discussion_r2463812546


##########
arrow-array/src/array/byte_view_array.rs:
##########
@@ -512,18 +512,72 @@ impl<T: ByteViewType + ?Sized> GenericByteViewArray<T> {
             };
         }
 
-        // 3) Allocate exactly capacity for all non-inline data
-        let mut data_buf = Vec::with_capacity(total_large);
+        struct GcCopyGroup {
+            total_buffer_bytes: usize,
+            total_len: usize,
+        }
+
+        let gc_copy_groups = if total_large > i32::MAX as usize {
+            // Slow-path: need to split into multiple copy groups
+            let mut groups = vec![];
+            let mut current_length = 0;
+            let mut current_elements = 0;
 
-        // 4) Iterate over views and process each inline/non-inline view
-        let views_buf: Vec<u128> = (0..len)
-            .map(|i| unsafe { self.copy_view_to_buffer(i, &mut data_buf) })
-            .collect();
+            for view in self.views() {
+                let len = *view as u32;

Review Comment:
   This part is so slow, but it's right, I can make it faster(by handling the 
numbers via grouping or batching) if required



##########
arrow-array/src/array/byte_view_array.rs:
##########
@@ -1404,6 +1463,55 @@ mod tests {
         }
     }
 
+    #[test]
+    fn test_gc_huge_array() {

Review Comment:
   This test requires about 5GiB memory, it's huge, I don't know would it 
affect the testing on some machines



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