etseidl commented on code in PR #9795:
URL: https://github.com/apache/arrow-rs/pull/9795#discussion_r3134517731


##########
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:
   I did a quick test of that idea earlier and it didn't seem worth the added 
complexity. But it probably deserves a second look on better hardware 😄.



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