Repository navigation
Conversation
alamb
commented
Jan 11, 2026
| offset: usize, | ||
| ) { | ||
| let (lower, upper) = iter.size_hint(); | ||
| let len = upper.expect("Iterator must have exact size_hint"); |
Author
There was a problem hiding this comment.
The bug is that new_len is in terms of bits but self.len is measured in bytes (this is probably left over from when this code was originally in the boolean builder)
| let mut builder = BooleanBufferBuilder::new(0); | ||
| let bools: Vec<_> = (0..10).map(|i| i % 2 == 0).collect(); | ||
| unsafe { builder.extend_trusted_len(bools.into_iter()) }; | ||
| assert_eq!(builder.as_slice().len(), bit_util::ceil(builder.len(), 8)); |
Author
There was a problem hiding this comment.
These tests fails like this without the fix:
failures:
---- builder::boolean::tests::test_extend_trusted_len_sets_byte_len stdout ----
thread 'builder::boolean::tests::test_extend_trusted_len_sets_byte_len' (28877654) panicked at arrow-buffer/src/builder/boolean.rs:611:9:
assertion `left == right` failed
left: 10
right: 2
---- builder::boolean::tests::test_extend_trusted_len_then_append stdout ----
thread 'builder::boolean::tests::test_extend_trusted_len_then_append' (28877655) panicked at arrow-buffer/src/builder/boolean.rs:621:9:
assertion `left == right` failed
left: 9
right: 2
failures:
builder::boolean::tests::test_extend_trusted_len_sets_byte_len
builder::boolean::tests::test_extend_trusted_len_then_append
test result: FAILED. 235 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.40s
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes a bug in
BooleanBufferBuilder::extend_trusted_lenapache/arrow-rs#9137(this was written by chatgpt codex, and I carefully reviewed it all)