lyang24 commented on code in PR #9093:
URL: https://github.com/apache/arrow-rs/pull/9093#discussion_r2715147659
##########
parquet/src/arrow/record_reader/mod.rs:
##########
@@ -169,7 +176,9 @@ where
/// Returns currently stored buffer data.
/// The side effect is similar to `consume_def_levels`.
pub fn consume_record_data(&mut self) -> V {
- std::mem::take(&mut self.values)
+ // Replace the buffer with a new one that has the same capacity
+ // This avoids reallocations on subsequent batches
+ std::mem::replace(&mut self.values,
V::with_capacity(self.capacity_hint))
Review Comment:
yes i approach it as making the value buffer optional the new will init as
None - we allocate when we are in we read_one_batch. Then the
consume_record_data just takes the ownership.
--
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]