MCPcopy Create free account
hub / github.com/apache/arrow / Validate

Method Validate

cpp/src/parquet/size_statistics.cc:68–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68void SizeStatistics::Validate(const ColumnDescriptor* descr) const {
69 auto validate_histogram = [](const std::vector<int64_t>& histogram, int16_t max_level,
70 const std::string& name) {
71 if (histogram.empty()) {
72 // A levels histogram is always allowed to be missing.
73 return;
74 }
75 if (histogram.size() != static_cast<size_t>(max_level + 1)) {
76 std::stringstream ss;
77 ss << name << " level histogram size mismatch, size: " << histogram.size()
78 << ", expected: " << (max_level + 1);
79 throw ParquetException(ss.str());
80 }
81 };
82 validate_histogram(repetition_level_histogram, descr->max_repetition_level(),
83 "Repetition");
84 validate_histogram(definition_level_histogram, descr->max_definition_level(),
85 "Definition");
86 if (unencoded_byte_array_data_bytes.has_value() &&
87 descr->physical_type() != Type::BYTE_ARRAY) {
88 throw ParquetException("Unencoded byte array data bytes does not support " +
89 TypeToString(descr->physical_type()));
90 }
91}
92
93void SizeStatistics::Reset() {
94 repetition_level_histogram.assign(repetition_level_histogram.size(), 0);

Callers 1

Calls 6

ParquetExceptionFunction · 0.85
TypeToStringFunction · 0.85
strMethod · 0.80
physical_typeMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected