Skip to content
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

perf: Provide a fallback skip batch predicate for constant batches #21477

Merged

Conversation

coastalwhite
Copy link
Collaborator

This PR adds a fallback for skip batch predicate if we don't have a better specialized implementation. Namely any expression that does not have a better fallback now gets lowered to:

E -> all(col(A_min) == col(A_max) & col(A_nc) == 0 for A in LIVE(E)) & ~(E)

This basically means that if the predicate columns are constant for a batch, we now are always accurately predict whether we can skip it.

Specifically, this makes pruning hive partitions much more consistent and potent.

Fixes #21472.

This PR adds a fallback for skip batch predicate if we don't have a better
specialized implementation. Namely any expression that does not have a better
fallback now gets lowered to:

```
E -> all(col(A_min) == col(A_max) & col(A_nc) == 0 for A in LIVE(E)) & ~(E)
```

This basically means that if the predicate columns are constant for a batch, we
now are always accurately predict whether we can skip it.

Specifically, this makes pruning hive partitions much more consistent and
potent.

Fixes pola-rs#21472.
@github-actions github-actions bot added performance Performance issues or improvements python Related to Python Polars rust Related to Rust Polars labels Feb 26, 2025
Copy link

codecov bot commented Feb 26, 2025

Codecov Report

Attention: Patch coverage is 96.15385% with 1 line in your changes missing coverage. Please review.

Project coverage is 79.99%. Comparing base (c37e482) to head (74659ee).
Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
crates/polars-plan/src/utils.rs 95.45% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #21477      +/-   ##
==========================================
- Coverage   80.02%   79.99%   -0.03%     
==========================================
  Files        1597     1598       +1     
  Lines      229111   229265     +154     
  Branches     2620     2623       +3     
==========================================
+ Hits       183338   183402      +64     
- Misses      45174    45258      +84     
- Partials      599      605       +6     

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

@coastalwhite coastalwhite merged commit bf1b47f into pola-rs:main Feb 26, 2025
23 checks passed
@coastalwhite coastalwhite deleted the perf/fallback-skip-batch-predicate branch February 26, 2025 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance issues or improvements python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hive predicate pushdown not working with multiple filters
1 participant