Skip to content

[Parquet] Skip bloom filter predicate evaluation when no bloom filters are loaded - #24101

Open
rgehan wants to merge 1 commit into
apache:mainfrom
rgehan:bloom-filter-skip-empty-eval
Open

[Parquet] Skip bloom filter predicate evaluation when no bloom filters are loaded#24101
rgehan wants to merge 1 commit into
apache:mainfrom
rgehan:bloom-filter-skip-empty-eval

Conversation

@rgehan

@rgehan rgehan commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #24107

Rationale for this change

Bloom filter pruning codepath evaluates pruning predicates even when no bloom filters are defined for the row group.

For wide / expensive predicates, this can add visible latency.

This PR suggests shunting the evaluation of the predicate altogether when a row group provably doesn't contain bloom filters.

What changes are included in this PR?

Short-circuits the pruning predicate evaluation in bloom filter pruning codepath when there are no bloom filters.

Are these changes tested?

Yes, but the assertions are weak and cannot differentiate between a skipped pruning predicate (no bloom filter case) vs a pruning predicate that was evaluated and matches the row group.

I suppose we could build a test with an expensive predicate, and rely on the timer, but I find time-based tests to be generally weak/flaky. Let me know if you prefer this solution / if you see a better approach.

Are there any user-facing changes?

None

Evaluating the pruning predicate runs once per row group and is expensive for wide predicates, yet it can never prune a row group that has no bloom filters to consult.

Short-circuit the per-row-group evaluation, and skip the pass entirely when no bloom filters were loaded for any row group (files written without them).
@github-actions github-actions Bot added the datasource Changes to the datasource crate label Aug 5, 2026
assert_pruned(row_groups, ExpectedPruning::Some(vec![0]));
assert_eq!(metrics.row_groups_pruned_bloom_filter.pruned(), 1);
assert_eq!(metrics.row_groups_pruned_bloom_filter.matched(), 1);
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not a big fan of this test, as it would pass even without the fix, and doesn't really distinguish between "skipped predicate" and "evaluated predicate that matches".

An alternative would be to test with an expensive predicate, and assert on the timer, but that sounds fragile.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.91%. Comparing base (2dd1a14) to head (450e56a).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #24101   +/-   ##
=======================================
  Coverage   80.91%   80.91%           
=======================================
  Files        1102     1102           
  Lines      377102   377129   +27     
  Branches   377102   377129   +27     
=======================================
+ Hits       305127   305156   +29     
+ Misses      53784    53780    -4     
- Partials    18191    18193    +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Parquet] Pruning predicates are evaluated in bloom filter codepaths, even when there are no bloom filters

2 participants