Skip to content

[branch-54] backport #22857 (Skip loading Parquet page index when row-group statistics already prove it cannot prune)#23088

Merged
mbutrovich merged 3 commits into
apache:branch-54from
mbutrovich:branch-54-22857
Jun 22, 2026
Merged

[branch-54] backport #22857 (Skip loading Parquet page index when row-group statistics already prove it cannot prune)#23088
mbutrovich merged 3 commits into
apache:branch-54from
mbutrovich:branch-54-22857

Conversation

@mbutrovich

Copy link
Copy Markdown
Contributor

backport #22857 to branch-54 in anticipation of 54.1.0 release. DataFusion Comet encountered this issue while trying to upgrade to DF 54.0.0, so it would ease that upgrade for Comet if this were backported.

This one had conflicts on cherry-pick, so I could use a sanity check on the review by comparing to the original PR.

…ve it cannot prune (apache#22857)

- Closes apache#22795

The Parquet opener was loading the page index (ColumnIndex +
OffsetIndex) before row-group statistics pruning. When all surviving row
groups are fully matched by row-group statistics (for example, `IS NOT
NULL` on a non-null column), page index I/O cannot prune further and is
wasted.

- Reorder the opener state machine: `PrepareFilters →
PruneWithStatistics → LoadPageIndex? → LoadBloomFilters`
- Skip `load_page_index` when there is no page-pruning predicate, no
surviving row groups, or every surviving row group is fully matched
- Add unit and integration tests for the gate and the fully-matched `IS
NOT NULL` case

- `cargo test -p datafusion-datasource-parquet should_load`
- `cargo test -p datafusion-datasource-parquet page_index_skip`
- `cargo test -p datafusion-datasource-parquet
opener::test::test_page_pruning`
- `cargo test -p datafusion --test parquet_integration`
- `cargo clippy -p datafusion-datasource-parquet --all-targets -- -D
warnings`

No user-facing API changes. This reduces unnecessary Parquet page index
I/O during scan planning when row-group statistics already prove no
further pruning is possible.

Made with [Cursor](https://cursor.com)

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
(cherry picked from commit 1fd29c9)
@github-actions github-actions Bot added sqllogictest SQL Logic Tests (.slt) datasource Changes to the datasource crate labels Jun 22, 2026
@comphead

Copy link
Copy Markdown
Contributor

The backport fails on compilation issues

@comphead comphead left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @mbutrovich

@mbutrovich mbutrovich merged commit 21e5d49 into apache:branch-54 Jun 22, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

datasource Changes to the datasource crate sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants