Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion cpp/src/parquet/metadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,15 @@ static std::shared_ptr<Statistics> MakeTypedColumnStats(
metadata.statistics.__isset.null_count,
metadata.statistics.__isset.distinct_count);
}
// GH-34139: If SortOrder is not SIGNED, ignore min and max.
bool can_use_legacy_min_max = descr->sort_order() == SortOrder::SIGNED;
// Default behavior
return MakeStatistics<DType>(
descr, metadata.statistics.min, metadata.statistics.max,
metadata.num_values - metadata.statistics.null_count,
metadata.statistics.null_count, metadata.statistics.distinct_count,
metadata.statistics.__isset.max || metadata.statistics.__isset.min,
can_use_legacy_min_max &&
(metadata.statistics.__isset.max || metadata.statistics.__isset.min),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that parquet-mr uses && rather than ||. It probably doesn't make a difference in practice (either min/max are both available, or none is available).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to change || to && in an old PR and it caused some test failure because filter pushdown of dataset scanner can handle the case when either min or max is missing.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, funny. Let's keep it like this, then.

metadata.statistics.__isset.null_count, metadata.statistics.__isset.distinct_count);
}

Expand Down