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
tobixdev pushed a commit to tobixdev/datafusion that referenced this pull request Nov 2, 2025
## Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes apache#123` indicates that this PR will close issue apache#123.
-->

- Closes #.

## Rationale for this change

<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->
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 apache#18321 (comment)
for reproducing.

## What changes are included in this PR?

<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes 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
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->

## Are there any user-facing changes?
No
<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->

<!--
If there are any breaking changes to public APIs, please add the `api
change` label.
-->
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