pub struct NullBufferBuilder {
bitmap_builder: Option<BooleanBufferBuilder>,
len: usize,
capacity: usize,
}
Expand description
Builder for creating the null bit buffer.
This builder only materializes the buffer when we append false
.
If you only append true
s to the builder, what you get will be
None
when calling finish
.
This optimization is very important for the performance.
Fields§
§bitmap_builder: Option<BooleanBufferBuilder>
§len: usize
Store the length of the buffer before materializing.
capacity: usize
Implementations§
Source§impl NullBufferBuilder
impl NullBufferBuilder
Sourcepub fn new(capacity: usize) -> Self
pub fn new(capacity: usize) -> Self
Creates a new empty builder.
capacity
is the number of bits in the null buffer.
Sourcepub fn new_with_len(len: usize) -> Self
pub fn new_with_len(len: usize) -> Self
Creates a new builder with given length.
Sourcepub fn new_from_buffer(buffer: MutableBuffer, len: usize) -> Self
pub fn new_from_buffer(buffer: MutableBuffer, len: usize) -> Self
Creates a new builder from a MutableBuffer
.
Sourcepub fn append_n_non_nulls(&mut self, n: usize)
pub fn append_n_non_nulls(&mut self, n: usize)
Appends n
true
s into the builder
to indicate that these n
items are not nulls.
Sourcepub fn append_non_null(&mut self)
pub fn append_non_null(&mut self)
Appends a true
into the builder
to indicate that this item is not null.
Sourcepub fn append_n_nulls(&mut self, n: usize)
pub fn append_n_nulls(&mut self, n: usize)
Appends n
false
s into the builder
to indicate that these n
items are nulls.
Sourcepub fn append_null(&mut self)
pub fn append_null(&mut self)
Appends a false
into the builder
to indicate that this item is null.
Sourcepub fn append_slice(&mut self, slice: &[bool])
pub fn append_slice(&mut self, slice: &[bool])
Appends a boolean slice into the builder to indicate the validations of these items.
Sourcepub fn finish(&mut self) -> Option<NullBuffer>
pub fn finish(&mut self) -> Option<NullBuffer>
Builds the null buffer and resets the builder.
Returns None
if the builder only contains true
s.
Sourcepub fn finish_cloned(&self) -> Option<NullBuffer>
pub fn finish_cloned(&self) -> Option<NullBuffer>
Builds the NullBuffer without resetting the builder.
fn materialize_if_needed(&mut self)
fn materialize(&mut self)
Sourcepub fn as_slice_mut(&mut self) -> Option<&mut [u8]>
pub fn as_slice_mut(&mut self) -> Option<&mut [u8]>
Return a mutable reference to the inner bitmap slice.
Sourcepub fn allocated_size(&self) -> usize
pub fn allocated_size(&self) -> usize
Return the allocated size of this builder, in bytes, useful for memory accounting.