Rich-T-kid commented on code in PR #10397:
URL: https://github.com/apache/arrow-rs/pull/10397#discussion_r3666875037


##########
arrow-array/src/array/boolean_array.rs:
##########
@@ -593,8 +593,19 @@ impl BooleanArray {
             return self;
         };
 
-        let mut builder = BooleanBufferBuilder::new(len);
-        builder.append_buffer(&self.values.slice(0, end));
+        let mut builder = match self.values.try_into_builder() {
+            Ok(mut builder) => {
+                // reuse allocation, just resize buffer
+                builder.truncate(end);
+                builder
+            }
+            Err(values) => {

Review Comment:
   ahh this is much cleaner than https://github.com/apache/arrow-rs/pull/10438



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