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 Parquet for sliced lists #18073

Merged

Conversation

coastalwhite
Copy link
Collaborator

This is a relatively small fix for what was a quite nasty bug.

Fixes #18069.

@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Aug 7, 2024
Copy link

codecov bot commented Aug 7, 2024

Codecov Report

Attention: Patch coverage is 82.60870% with 4 lines in your changes missing coverage. Please review.

Project coverage is 80.36%. Comparing base (3dda47e) to head (26a443f).

Files Patch % Lines
crates/polars-arrow/src/array/binview/mod.rs 40.00% 3 Missing ⚠️
crates/polars-parquet/src/arrow/write/pages.rs 94.44% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #18073      +/-   ##
==========================================
- Coverage   80.37%   80.36%   -0.01%     
==========================================
  Files        1496     1496              
  Lines      197542   197555      +13     
  Branches     2820     2820              
==========================================
- Hits       158771   158770       -1     
- Misses      38249    38263      +14     
  Partials      522      522              

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

let validity = validity.freeze();

array_stack.push_front((array.values().as_ref(), BitmapState::SomeSet(validity)));
debug_assert_eq!(validity.len(), array.values().len());
array_stack.push((array.values().as_ref(), BitmapState::SomeSet(validity)));
Copy link
Member

Choose a reason for hiding this comment

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

Instead of extending the bitmap, can't we slice the values with the offsets start/end? Then we serialize the minimal amount of data.

Copy link
Collaborator Author

@coastalwhite coastalwhite Aug 7, 2024

Choose a reason for hiding this comment

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

I tried this first and it sadly does not work. It would require changing a significant part of the Parquet writing code.

Most of the code there assumes that it is being handed the whole array and it can slice it up itself.

@ritchie46 ritchie46 merged commit a7aebee into pola-rs:main Aug 8, 2024
27 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.

Possible Bug: assertion failed: 8 * slice.len() >= offset + len
2 participants