Skip to content

Commit 54fa244

Browse files
committed
GH-51673: Address metadata printer review comments
1 parent 175d3de commit 54fa244

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

‎cpp/src/parquet/printer.cc‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,24 +167,24 @@ void ParquetFilePrinter::DebugPrint(std::ostream& stream, std::list<int> selecte
167167
}
168168
stream << " Values: " << column_chunk->num_values();
169169
if (column_chunk->is_stats_set()) {
170-
std::string max_exact =
171-
stats->is_max_value_exact.has_value()
172-
? (stats->is_max_value_exact.value() ? "true" : "false")
173-
: "unknown";
174-
std::string min_exact =
175-
stats->is_min_value_exact.has_value()
176-
? (stats->is_min_value_exact.value() ? "true" : "false")
177-
: "unknown";
178170
stream << ", Null Values: " << stats->null_count
179171
<< ", Distinct Values: " << stats->distinct_count;
180172
if (stats->has_max || stats->has_min) {
181173
stream << std::endl << " ";
182174
if (stats->has_max) {
175+
std::string max_exact =
176+
stats->is_max_value_exact.has_value()
177+
? (stats->is_max_value_exact.value() ? "true" : "false")
178+
: "unknown";
183179
stream << "Max (exact: " << max_exact << "): "
184180
<< FormatStatValue(descr->physical_type(), stats->max(),
185181
descr->logical_type());
186182
}
187183
if (stats->has_min) {
184+
std::string min_exact =
185+
stats->is_min_value_exact.has_value()
186+
? (stats->is_min_value_exact.value() ? "true" : "false")
187+
: "unknown";
188188
if (stats->has_max) {
189189
stream << ", ";
190190
}

‎cpp/src/parquet/reader_test.cc‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,8 @@ TEST_F(TestAllTypesPlain, DebugPrintWorks) {
569569
}
570570

571571
TEST(TestDebugPrintWithMemoryFile, AllNullDecimalStatistics) {
572+
// GH-51673: An all-null DECIMAL column has a null count but no min/max.
573+
// The printer must not try to decode missing min/max values.
572574
auto schema = std::static_pointer_cast<GroupNode>(GroupNode::Make(
573575
"schema", Repetition::REQUIRED,
574576
{PrimitiveNode::Make("decimal", Repetition::OPTIONAL,

0 commit comments

Comments
 (0)