Skip to content

Commit

Permalink
Minor: Clarify NullBufferBuilder::new capacity parameter (#7016)
Browse files Browse the repository at this point in the history
* Minor: Clarify NullBufferBuilder::new capacity parameter

* Update arrow-buffer/src/builder/null.rs

Co-authored-by: Jeffrey Vo <[email protected]>

---------

Co-authored-by: Jeffrey Vo <[email protected]>
  • Loading branch information
alamb and Jefffrey authored Jan 25, 2025
1 parent 4862318 commit 6340d46
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion arrow-buffer/src/builder/boolean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ pub struct BooleanBufferBuilder {
}

impl BooleanBufferBuilder {
/// Creates a new `BooleanBufferBuilder`
/// Creates a new `BooleanBufferBuilder` with sufficient space for
/// `capacity` bits (not bytes).
///
/// The capacity is rounded up to the nearest multiple of 8 for the
/// allocation.
#[inline]
pub fn new(capacity: usize) -> Self {
let byte_capacity = bit_util::ceil(capacity, 8);
Expand Down
5 changes: 4 additions & 1 deletion arrow-buffer/src/builder/null.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ pub struct NullBufferBuilder {

impl NullBufferBuilder {
/// Creates a new empty builder.
/// `capacity` is the number of bits in the null buffer.
///
/// Note that this method does not allocate any memory, regardless of the
/// `capacity` parameter. If an allocation is required, `capacity` is the
/// size in bits (not bytes) that will be allocated at minimum.
pub fn new(capacity: usize) -> Self {
Self {
bitmap_builder: None,
Expand Down

0 comments on commit 6340d46

Please sign in to comment.