pitrou commented on code in PR #45285:
URL: https://github.com/apache/arrow/pull/45285#discussion_r1918915857


##########
cpp/src/parquet/size_statistics.cc:
##########
@@ -64,14 +64,19 @@ void 
SizeStatistics::IncrementUnencodedByteArrayDataBytes(int64_t value) {
 }
 
 void SizeStatistics::Validate(const ColumnDescriptor* descr) const {
-  if (repetition_level_histogram.size() !=
-      static_cast<size_t>(descr->max_repetition_level() + 1)) {
-    throw ParquetException("Repetition level histogram size mismatch");
-  }
-  if (definition_level_histogram.size() !=
-      static_cast<size_t>(descr->max_definition_level() + 1)) {
-    throw ParquetException("Definition level histogram size mismatch");
-  }
+  auto validate_histogram = [](const std::vector<int64_t>& histogram, int16_t 
max_level,
+                               const std::string& name) {
+    if (max_level == 0 && histogram.empty()) {
+      return;
+    }

Review Comment:
   As discussed in the comments, I think we should relax this:
   ```suggestion
       if (histogram.empty()) {
         // A levels histogram is always allowed to be missing.
         return;
       }
   ```



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