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: Properly write nest-nulled values in Parquet #17845

Merged

Conversation

coastalwhite
Copy link
Collaborator

@coastalwhite coastalwhite commented Jul 24, 2024

Fixes #17805.

This fixes an issue in the Parquet writer where values that would be valid in the primitive array but invalid at a higher nesting level would still be written. This could for example be true when do x = (x == "") ? [ x ] : None. In this case, the empty string might still be valid but the above list is not valid anymore.

This is solved by walking through the structure and propagating the nulls to the lower levels in the parquet writer.

@coastalwhite coastalwhite changed the title fix: properly write nest-nulled values in Parquet fix: Properly write nest-nulled values in Parquet Jul 24, 2024
@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars and removed title needs formatting labels Jul 24, 2024
@coastalwhite coastalwhite force-pushed the fix-parquet-nested-nullability-17805 branch from 57ae3b3 to c389490 Compare July 24, 2024 14:11
Fixes pola-rs#17805.

This fixes an issue on the Parquet writer where values that would be valid in
the primitive array but invalid at a higher nesting level would still be
written. This could for example be true when do `x = (x == "") ? [ x ] : None`.
In this case, the empty string might still be valid but the above list is not
valid anymore.

This is solved by walking through the structure and propagating the nulls to
the lower levels in the parquet writer.
@coastalwhite coastalwhite force-pushed the fix-parquet-nested-nullability-17805 branch from c389490 to dee3c87 Compare July 24, 2024 14:15
Copy link

codecov bot commented Jul 24, 2024

Codecov Report

Attention: Patch coverage is 85.52632% with 22 lines in your changes missing coverage. Please review.

Project coverage is 80.52%. Comparing base (954538e) to head (6224d84).
Report is 11 commits behind head on main.

Files Patch % Lines
crates/polars-parquet/src/arrow/write/pages.rs 85.52% 22 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17845      +/-   ##
==========================================
+ Coverage   80.50%   80.52%   +0.02%     
==========================================
  Files        1504     1505       +1     
  Lines      197162   197387     +225     
  Branches     2806     2807       +1     
==========================================
+ Hits       158721   158942     +221     
- Misses      37920    37923       +3     
- Partials      521      522       +1     

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

@ritchie46 ritchie46 merged commit 2a6ebec into pola-rs:main Jul 25, 2024
26 checks passed
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 rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using pl.write_parquet() gives wrong results for values inside lists.
2 participants