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

fix(python): Avoid loading all columns in read_parquet when columns parameter is specified #15229

Merged
merged 1 commit into from
Mar 22, 2024

Conversation

itamarst
Copy link
Contributor

Fixes #15098

Without optimizations, all columns would be loaded regardless of the columns argument, leading to higher CPU and memory usage.

Without optimizations, all columns would be loaded regardless of the columns argument, leading to higher CPU and memory usage.
@github-actions github-actions bot added fix Bug fix python Related to Python Polars labels Mar 22, 2024
@itamarst itamarst changed the title fix(python): Re-enable optimizations when using read_parquet(). fix(python): Don't load all columns in read_parquet() if the user asked for only a subset Mar 22, 2024
@itamarst
Copy link
Contributor Author

If you think a test to catch future regressions would be helpful, should be able to do so with pytest-memray.

@itamarst itamarst marked this pull request as ready for review March 22, 2024 12:42
@stinodego stinodego changed the title fix(python): Don't load all columns in read_parquet() if the user asked for only a subset fix(python): Avoid loading all columns in read_parquet when columns parameter is specified Mar 22, 2024
Copy link
Member

@stinodego stinodego left a comment

Choose a reason for hiding this comment

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

Thanks for noticing this one. That's a painful miss 😓

I'd be interested in a way to catch these types of bugs if we can do so without overly bloating the CI.

Copy link

codecov bot commented Mar 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.26%. Comparing base (474ac34) to head (bd8ef13).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15229      +/-   ##
==========================================
- Coverage   81.26%   81.26%   -0.01%     
==========================================
  Files        1355     1355              
  Lines      175676   175676              
  Branches     2518     2518              
==========================================
- Hits       142761   142755       -6     
- Misses      32434    32439       +5     
- Partials      481      482       +1     

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

@itamarst
Copy link
Contributor Author

Given the impact of this (and the minor nature of the semantic change), I'd suggest you merge this without tests and I'll see about the testing in a separate issue. The tests would presumably want to cover a larger set of code anyway.

@stinodego stinodego merged commit 6503abc into pola-rs:main Mar 22, 2024
15 checks passed
@itamarst itamarst deleted the 15098-read-parquet-inefficient branch March 22, 2024 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

High memory usage reading single column with read_parquet
3 participants