Skip to content

Conversation

@2010YOUY01
Copy link
Contributor

Which issue does this PR close?

  • Closes #.

Rationale for this change

It's better to let pruning metrics in parquet displayed in an order that is the same as the actual pruning order:

metrics=...files_ranges_pruned_statistics=21 total → 3 matched, row_groups_pruned_statistics=1 total → 1 matched, row_groups_pruned_bloom_filter=1 total → 1 matched, page_index_rows_pruned=748901 total → 19813 matched...

Now it's ordered alphabetically.
See #18321 (comment) for reproducing.

What changes are included in this PR?

Update the sort key API in MetricValue, to let the parquet pruning metrics display in the expected order.

Are these changes tested?

UT

Are there any user-facing changes?

No

@github-actions github-actions bot added core Core DataFusion crate physical-plan Changes to the physical-plan crate labels Oct 30, 2025
Self::PruningMetrics { name, .. } => match name.as_ref() {
// The order is the same as the actual pruning order: from
// coarse-grained to fine-grained pruning levels.
"files_ranges_pruned_statistics" => 3,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a little bit hacky 🤔 but I think this way is simpler and easy to update.

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe a comment could help / ticket to assist others who find this code and are confused by it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, comments added.

Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

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

Thanks @2010YOUY01
just 1 thing, if the name is changed for example from files_ranges_pruned_statistics to files_ranges_pruned_statistics_other in project but not in value.rs will the test detect it and fail?

@2010YOUY01
Copy link
Contributor Author

Thanks @2010YOUY01 just 1 thing, if the name is changed for example from files_ranges_pruned_statistics to files_ranges_pruned_statistics_other in project but not in value.rs will the test detect it and fail?

Yes, the UT in this PR will catch such changes.

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thanks @2010YOUY01 -- the metrics just keep getting better!

Self::PruningMetrics { name, .. } => match name.as_ref() {
// The order is the same as the actual pruning order: from
// coarse-grained to fine-grained pruning levels.
"files_ranges_pruned_statistics" => 3,
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe a comment could help / ticket to assist others who find this code and are confused by it

@2010YOUY01
Copy link
Contributor Author

Thank you both for the review!

@2010YOUY01 2010YOUY01 added this pull request to the merge queue Oct 31, 2025
Merged via the queue into apache:main with commit e65dafe Oct 31, 2025
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate physical-plan Changes to the physical-plan crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants