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: parquet hybrid RLE encoding did not always align to bit width #13883

Merged
merged 3 commits into from
Jan 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ fn bitpacked_encode_u32<W: Write, I: Iterator<Item = u32>>(
}

if remainder != 0 {
let compressed_remainder_size = ceil8(remainder * num_bits);
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a comment to this PR here?

// Must be careful here to ensure we write a multiple of `num_bits`
// (the bit width) to align with the spec. Some readers also rely on
// this - see https://github.com/pola-rs/polars/pull/13883.
let compressed_remainder_size = ceil8(remainder) * num_bits;
iterator
.by_ref()
.take(remainder)
Expand Down Expand Up @@ -129,7 +132,13 @@ mod tests {

assert_eq!(
vec,
vec![(2 << 1 | 1), 0b01_10_01_00, 0b00_01_01_10, 0b_00_00_00_11]
vec![
(2 << 1 | 1),
0b01_10_01_00,
0b00_01_01_10,
0b_00_00_00_11,
0b0
]
);
Ok(())
}
Expand Down