alamb commented on code in PR #9795:
URL: https://github.com/apache/arrow-rs/pull/9795#discussion_r3134438282
##########
parquet/src/column/writer/mod.rs:
##########
@@ -708,15 +694,15 @@ impl<'a, E: ColumnValueEncoder> GenericColumnWriter<'a,
E> {
));
}
- // Count the occasions where we start a new row
- for &level in levels {
- self.page_metrics.num_buffered_rows += (level == 0) as u32
- }
-
- // Update histogram
- self.page_metrics.update_repetition_level_histogram(levels);
-
- self.rep_levels_encoder.put(levels);
+ let mut new_rows = 0u32;
+ self.rep_levels_encoder
+ .put_with_observer(levels, |level, count| {
+ new_rows += (count as u32) * (level == 0) as u32;
+ if let Some(ref mut h) =
self.page_metrics.repetition_level_histogram {
Review Comment:
You might be able to move this check out of the loop (so call `put` if
`self.page_metrics.repetition_level_histogram ` is none and and call
with_with_observer if it s some
Maybe could improve the inner loop even more
--
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]