This is an automated email from the ASF dual-hosted git repository.

tustvold pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/main by this push:
     new 6340d46144 Minor: Clarify NullBufferBuilder::new capacity parameter 
(#7016)
6340d46144 is described below

commit 6340d46144f9588b0a2b9270b01933b008829105
Author: Andrew Lamb <[email protected]>
AuthorDate: Sat Jan 25 10:19:52 2025 -0500

    Minor: Clarify NullBufferBuilder::new capacity parameter (#7016)
    
    * 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]>
---
 arrow-buffer/src/builder/boolean.rs | 6 +++++-
 arrow-buffer/src/builder/null.rs    | 5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/arrow-buffer/src/builder/boolean.rs 
b/arrow-buffer/src/builder/boolean.rs
index 67b306dd8c..0424e128d2 100644
--- a/arrow-buffer/src/builder/boolean.rs
+++ b/arrow-buffer/src/builder/boolean.rs
@@ -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);
diff --git a/arrow-buffer/src/builder/null.rs b/arrow-buffer/src/builder/null.rs
index 0ad62eacf4..f88868db8a 100644
--- a/arrow-buffer/src/builder/null.rs
+++ b/arrow-buffer/src/builder/null.rs
@@ -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,

Reply via email to