wgtmac commented on code in PR #40594:
URL: https://github.com/apache/arrow/pull/40594#discussion_r1843112793


##########
cpp/src/parquet/column_writer.cc:
##########
@@ -1708,10 +1790,15 @@ Status 
TypedColumnWriterImpl<DType>::WriteArrowDictionary(
       referenced_dictionary = referenced_dictionary_datum.make_array();
     }
 
-    int64_t non_null_count = chunk_indices->length() - 
chunk_indices->null_count();
-    page_statistics_->IncrementNullCount(num_chunk_levels - non_null_count);
-    page_statistics_->IncrementNumValues(non_null_count);
-    page_statistics_->Update(*referenced_dictionary, /*update_counts=*/false);
+    if (page_statistics_) {
+      int64_t non_null_count = chunk_indices->length() - 
chunk_indices->null_count();
+      page_statistics_->IncrementNullCount(num_chunk_levels - non_null_count);
+      page_statistics_->IncrementNumValues(non_null_count);
+      page_statistics_->Update(*referenced_dictionary, 
/*update_counts=*/false);
+    }
+    if (page_size_stats_builder_) {
+      page_size_stats_builder_->AddValues(*referenced_dictionary);

Review Comment:
   I dislike the approach as you did. It seems that it has been used for 
collecting page statistics already for a long time. Do you think it is better 
to fix it in a separate PR or just do it in this one altogether?



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to