Skip to content

Commit

Permalink
BooleanBufferBuilder correct buffer length (#1051) (#1052) (#1080)
Browse files Browse the repository at this point in the history
Co-authored-by: Raphael Taylor-Davies <1781103+tustvold@users.noreply.github.com>
  • Loading branch information
alamb and tustvold committed Dec 22, 2021
1 parent 3a5e354 commit 78721bc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arrow/src/array/builder.rs
Expand Up @@ -310,7 +310,7 @@ impl BooleanBufferBuilder {
#[inline]
pub fn new(capacity: usize) -> Self {
let byte_capacity = bit_util::ceil(capacity, 8);
let buffer = MutableBuffer::from_len_zeroed(byte_capacity);
let buffer = MutableBuffer::new(byte_capacity);
Self { buffer, len: 0 }
}

Expand Down Expand Up @@ -2713,7 +2713,8 @@ mod tests {
let buffer = b.finish();
assert_eq!(1, buffer.len());

let mut b = BooleanBufferBuilder::new(4);
// Overallocate capacity
let mut b = BooleanBufferBuilder::new(8);
b.append_slice(&[false, true, false, true]);
assert_eq!(4, b.len());
assert_eq!(512, b.capacity());
Expand Down

0 comments on commit 78721bc

Please sign in to comment.