- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.7k
feat: Better parquet row-group/page pruning metrics display #18321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| metrics.row_groups_pruned_bloom_filter.add(1); | ||
| metrics.row_groups_pruned_bloom_filter.add_pruned(1); | ||
| self.access_plan.skip(idx) | ||
| } else if !stats.column_sbbf.is_empty() { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before row_groups_matched_bloom_filter is not incremented if bf is not available, I think matched means not able to prune in the current stage, and this range should be further checked, so this should also be incremented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @2010YOUY01 -- this looks great to me
| /// Metric `files_ranges_pruned_statistics` tracks both pruned and matched count, | ||
| /// for testing purpose, here it only aggregate the `pruned` count. | ||
| fn files_ranges_pruned_statistics(&self) -> Option<usize> { | ||
| fn pruning_metric(&self, metric_name: &str) -> Option<(usize, usize)> { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would help to document here what the two usize return values were (total rows pruned and total rows matched)
| let plan = format!("{}", arrow::util::pretty::pretty_format_batches(&batches)?); | ||
| println!("{plan}"); | ||
| assert_contains!(&plan, "row_groups_pruned_statistics=1"); | ||
| assert_contains!(&plan, "row_groups_pruned_statistics=2 total → 1 matched"); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is so much clearer ❤️
| There are many test fixes due to the  The old behavior is, if bloom filter is not available, the 'matched' count will be 0, this PR changed  (Parquet scanner will first check statistics, next bloom filters for row group pruning) 
 Perhaps if bf is not available, we can let it show  | 
| 
 I suggest filing this as a ticket (a good first issue for example) | 
| I would actually suggest not printing anything if bloom filters are not available (rather than UNAVAILABLE) | 
## 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 #123` indicates that this PR will close issue #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 #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. -->
Which issue does this PR close?
PruningMetricsfor nicer metrics display #18299Rationale for this change
See writeup in #18297
This PR is for the remaining metrics in
DataSourceExecwith parquet data source.Demo
In datafusion-cli
What changes are included in this PR?
Update
row_groups_pruned_statistics,row_groups_pruned_bloom_filter,page_index_rows_prunedwith the newPruningMetricsmetric type.The functional changes in the pr are in
datafusion/datasource-parquet/src/*, it's only a few of lines, most changes are fixing tests.Are these changes tested?
UTs are updated for the new metrics
Are there any user-facing changes?
No