You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by dh...@apache.org on 2021/12/20 13:28:22 UTC
[arrow-rs] branch master updated: BooleanBufferBuilder correct buffer length (#1051) (#1052)
This is an automated email from the ASF dual-hosted git repository.
dheres pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new cd75a13 BooleanBufferBuilder correct buffer length (#1051) (#1052)
cd75a13 is described below
commit cd75a1357f881b66fa938e6c08bee014af8cd3d0
Author: Raphael Taylor-Davies <17...@users.noreply.github.com>
AuthorDate: Mon Dec 20 13:28:17 2021 +0000
BooleanBufferBuilder correct buffer length (#1051) (#1052)
---
arrow/src/array/builder.rs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arrow/src/array/builder.rs b/arrow/src/array/builder.rs
index af6f3c3..94c05c1 100644
--- a/arrow/src/array/builder.rs
+++ b/arrow/src/array/builder.rs
@@ -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 }
}
@@ -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());