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: use is_between to skip parquet row groups #14244

Merged
merged 1 commit into from
Feb 4, 2024

Conversation

taki-mekhalfa
Copy link
Contributor

@taki-mekhalfa taki-mekhalfa commented Feb 3, 2024

Closes #13908

I tried to add row groups pruning when handling is_between conditions.

example df:

>>> df
shape: (90, 1)
┌─────┐
│ d   │
│ --- │
│ i64 │
╞═════╡
│ 10  │
│ 11  │
│ 12  │
│ 13  │
│ 14  │
│ …   │
│ 95  │
│ 96  │
│ 97  │
│ 98  │
│ 99  │
└─────┘

>>> pl.scan_parquet('test.parquet').filter(pl.col('d').is_between(4, 9)).collect()
parquet file can be skipped, the statistics were sufficient to apply the predicate.
shape: (0, 1)
┌─────┐
│ d   │
│ --- │
│ i64 │
╞═════╡
└─────┘

>>> pl.scan_parquet('test.parquet').filter(pl.col('d').is_between(200, 900)).collect()
parquet file can be skipped, the statistics were sufficient to apply the predicate.
shape: (0, 1)
┌─────┐
│ d   │
│ --- │
│ i64 │
╞═════╡
└─────┘

>>> pl.scan_parquet('test.parquet').filter(pl.col('d').is_between(1, 10, closed='none')).collect()
parquet file can be skipped, the statistics were sufficient to apply the predicate.
shape: (0, 1)
┌─────┐
│ d   │
│ --- │
│ i64 │
╞═════╡
└─────┘

@github-actions github-actions bot added performance Performance issues or improvements python Related to Python Polars rust Related to Rust Polars labels Feb 3, 2024
@taki-mekhalfa taki-mekhalfa force-pushed the perf/is_between_skip_rg branch 3 times, most recently from b712902 to 292d780 Compare February 3, 2024 21:43
@deanm0000
Copy link
Collaborator

Fixes this #13908

Copy link
Member

@ritchie46 ritchie46 left a comment

Choose a reason for hiding this comment

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

Nice, thanks a lot.

@ritchie46 ritchie46 merged commit acd0bc8 into pola-rs:main Feb 4, 2024
18 checks passed
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.

Performance degradation in scan_parquet() vs. scan_pyarrow_dataset()
3 participants