tustvold commented on code in PR #5110:
URL: https://github.com/apache/arrow-rs/pull/5110#discussion_r1405475130
##########
parquet/src/column/writer/mod.rs:
##########
@@ -703,6 +725,35 @@ impl<'a, E: ColumnValueEncoder> GenericColumnWriter<'a, E>
{
(Some(min), Some(max)) => {
update_min(&self.descr, &min, &mut
self.column_metrics.min_column_value);
update_max(&self.descr, &max, &mut
self.column_metrics.max_column_value);
+
+ // Check if min/max are still ascending/descending across pages
+ // Null pages aren't considered in this sort order
+ let null_page = (self.page_metrics.num_buffered_rows as u64)
+ == self.page_metrics.num_page_nulls;
+ if !null_page {
+ if let Some((latest_min, latest_max)) =
&self.latest_non_null_data_page_min_max
+ {
+ if self.data_page_boundary_ascending {
+ // If latest min/max are greater than new min/max
then not ascending anymore
+ let not_ascending = compare_greater(&self.descr,
latest_min, &min)
+ || compare_greater(&self.descr, latest_max,
&max);
+ if not_ascending {
+ self.data_page_boundary_ascending = false;
+ }
+ }
+
+ if self.data_page_boundary_descending {
+ // If new min/max are greater than latest min/max
then not descending anymore
+ let not_descending = compare_greater(&self.descr,
&min, latest_min)
+ || compare_greater(&self.descr, &max,
latest_max);
+ if not_descending {
+ self.data_page_boundary_descending = false;
+ }
+ }
+ }
+ self.latest_non_null_data_page_min_max =
Some((min.clone(), max.clone()));
+ }
Review Comment:
Whilst I think this is correct, perhaps you could just change
update_column_offset_index to instead take `Option<&ValueStatistics<T>>`? This
would likely make the existing logic faster, and would make this logic perhaps
slightly easier to follow - it is a little surprising that boundary_order is
being updated outside of update_column_offset_index
--
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]