Repository navigation
refactor: split page index pruning into steps - #27975
Merged
Merged
Conversation
PagePruningAccessPlanFilter::prune_plan_with_page_index_and_metrics is one function of about 250 lines with 11 mutable locals. It mixes four things: ordinary page pruning of a row group, the update of the access plan, the search for fully matched rows that LIMIT pruning uses, and the row and page counts. The same four references to the file go to every helper that it calls. Add PagePruner, which holds the file and the counts of one pass. Each step is one method: - prune_row_group applies the predicates to one row group - apply_selection records the result in the access plan - fully_matched_selection finds the rows that pass for certain - prune_pages_for_predicate, which was a free function with six arguments PagePruningCounts holds the four counters and writes them to the metrics. inverted_predicates builds the inverse predicates. The entry point is now about 100 lines and reads as the sequence of those steps. No behavior changes: the order of the early returns, the counts and the number of predicate evaluations are the same. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
xudong963
approved these changes
Dec 4, 2026
zhuqi-lucas
approved these changes
Dec 4, 2026
Contributor
Author
|
Thanks folks! |
adriangb
added a commit
to adriangb/datafusion
that referenced
this pull request
Dec 4, 2026
apache#27975 split page index pruning into `PagePruner` steps. This merge keeps those steps and makes them read statistics by `ParquetStatisticsTarget`. `PagePruner` no longer holds the Arrow schema, because a target builds its statistics converter from the Parquet schema. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
PagePruningAccessPlanFilter::prune_plan_with_page_index_and_metricsis one function of about 250 lines with 11 mutable locals. It mixes four things:The LIMIT path is the hardest part to follow, and it sits in the middle of ordinary pruning. The same four references to the file (
arrow_schema,parquet_schema,parquet_metadata,file_metrics) go to every helper.What changes are included in this PR?
PagePrunerholds the file and the counts of one pass. Each step is one method:PagePruner::prune_row_groupPagePruner::apply_selectionPagePruner::fully_matched_selectioncompleteflagPagePruner::prune_pages_for_predicatePagePruner::page_countfully_matched_page_count, and an inline copy of the same expressionPagePruner::has_complete_page_indexPagePruningCountslet mut total_*and the four metric writesPagePruningAccessPlanFilter::inverted_predicatesNo behavior changes. The points that could change it, and that I checked against the old code:
inverse_pruning_short_circuitscounts them.What is the testing strategy for this PR?
No new tests: this is a refactor, and the existing tests cover the code. They pass without changes:
datafusion-datasource-parquet(318), including the page filter tests for LIMIT pruning.datafusion/core/tests/parquet(265), which assert the page index metrics.I did not run benchmarks. The code runs the same steps in the same order, and it keeps the two page sets that the old code reuses across row groups.
Are there any user-facing changes?
No. Every new item is private.
🤖 Generated with Claude Code