pub struct NullBuffer { /* private fields */ }Expand description
A BooleanBuffer used to encode validity for Arrow arrays
In the Arrow specification, array validity is encoded in a packed bitmask with a
true value indicating the corresponding slot is not null, and false indicating
that it is null.
NullBuffers can be creating using NullBufferBuilder
Implementations§
Source§impl NullBuffer
impl NullBuffer
Sourcepub fn new(buffer: BooleanBuffer) -> NullBuffer
pub fn new(buffer: BooleanBuffer) -> NullBuffer
Create a new NullBuffer computing the null count
Sourcepub fn new_null(len: usize) -> NullBuffer
pub fn new_null(len: usize) -> NullBuffer
Create a new NullBuffer of length len where all values are null
Sourcepub fn new_valid(len: usize) -> NullBuffer
pub fn new_valid(len: usize) -> NullBuffer
Create a new NullBuffer of length len where all values are valid
Note: it is more efficient to not set the null buffer if it is known to be all valid (aka all values are not null)
Sourcepub unsafe fn new_unchecked(
buffer: BooleanBuffer,
null_count: usize,
) -> NullBuffer
pub unsafe fn new_unchecked( buffer: BooleanBuffer, null_count: usize, ) -> NullBuffer
Create a new NullBuffer with the provided buffer and null_count
§Safety
buffer must contain null_count 0 bits
Sourcepub fn union(
lhs: Option<&NullBuffer>,
rhs: Option<&NullBuffer>,
) -> Option<NullBuffer>
pub fn union( lhs: Option<&NullBuffer>, rhs: Option<&NullBuffer>, ) -> Option<NullBuffer>
Computes the union of the nulls in two optional NullBuffer
This is commonly used by binary operations where the result is NULL if either of the input values is NULL. Handling the null mask separately in this way can yield significant performance improvements over an iterator approach
Sourcepub fn contains(&self, other: &NullBuffer) -> bool
pub fn contains(&self, other: &NullBuffer) -> bool
Returns true if all nulls in other also exist in self
Sourcepub fn expand(&self, count: usize) -> NullBuffer
pub fn expand(&self, count: usize) -> NullBuffer
Returns a new NullBuffer where each bit in the current null buffer
is repeated count times. This is useful for masking the nulls of
the child of a FixedSizeListArray based on its parent
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the length of this NullBuffer in bits
Sourcepub fn offset(&self) -> usize
pub fn offset(&self) -> usize
Returns the offset of this NullBuffer in bits
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if this NullBuffer is empty
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Free up unused memory.
Sourcepub fn null_count(&self) -> usize
pub fn null_count(&self) -> usize
Returns the null count for this NullBuffer
Sourcepub fn validity(&self) -> &[u8] ⓘ
pub fn validity(&self) -> &[u8] ⓘ
Returns the packed validity of this NullBuffer not including any offset
Sourcepub fn slice(&self, offset: usize, len: usize) -> NullBuffer
pub fn slice(&self, offset: usize, len: usize) -> NullBuffer
Slices this NullBuffer by the provided offset and length
Sourcepub fn iter(&self) -> BitIterator<'_> ⓘ
pub fn iter(&self) -> BitIterator<'_> ⓘ
Returns an iterator over the bits in this NullBuffer
trueindicates that the corresponding value is not NULLfalseindicates that the corresponding value is NULL
Note: Self::valid_indices will be significantly faster for most use-cases
Sourcepub fn valid_indices(&self) -> BitIndexIterator<'_> ⓘ
pub fn valid_indices(&self) -> BitIndexIterator<'_> ⓘ
Returns a BitIndexIterator over the valid indices in this NullBuffer
Valid indices indicate the corresponding value is not NULL
Sourcepub fn valid_slices(&self) -> BitSliceIterator<'_> ⓘ
pub fn valid_slices(&self) -> BitSliceIterator<'_> ⓘ
Returns a BitSliceIterator yielding contiguous ranges of valid indices
Valid indices indicate the corresponding value is not NULL
Sourcepub fn try_for_each_valid_idx<E, F>(&self, f: F) -> Result<(), E>
pub fn try_for_each_valid_idx<E, F>(&self, f: F) -> Result<(), E>
Calls the provided closure for each index in this null mask that is set
Sourcepub fn inner(&self) -> &BooleanBuffer
pub fn inner(&self) -> &BooleanBuffer
Returns the inner BooleanBuffer
Sourcepub fn into_inner(self) -> BooleanBuffer
pub fn into_inner(self) -> BooleanBuffer
Returns the inner BooleanBuffer
Trait Implementations§
Source§impl Clone for NullBuffer
impl Clone for NullBuffer
Source§fn clone(&self) -> NullBuffer
fn clone(&self) -> NullBuffer
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NullBuffer
impl Debug for NullBuffer
Source§impl From<&[bool]> for NullBuffer
impl From<&[bool]> for NullBuffer
Source§fn from(value: &[bool]) -> NullBuffer
fn from(value: &[bool]) -> NullBuffer
Source§impl From<BooleanBuffer> for NullBuffer
impl From<BooleanBuffer> for NullBuffer
Source§fn from(value: BooleanBuffer) -> NullBuffer
fn from(value: BooleanBuffer) -> NullBuffer
Source§impl FromIterator<bool> for NullBuffer
impl FromIterator<bool> for NullBuffer
Source§fn from_iter<T>(iter: T) -> NullBufferwhere
T: IntoIterator<Item = bool>,
fn from_iter<T>(iter: T) -> NullBufferwhere
T: IntoIterator<Item = bool>,
Source§impl<'a> IntoIterator for &'a NullBuffer
impl<'a> IntoIterator for &'a NullBuffer
Source§type IntoIter = BitIterator<'a>
type IntoIter = BitIterator<'a>
Source§fn into_iter(self) -> <&'a NullBuffer as IntoIterator>::IntoIter
fn into_iter(self) -> <&'a NullBuffer as IntoIterator>::IntoIter
Source§impl PartialEq for NullBuffer
impl PartialEq for NullBuffer
impl Eq for NullBuffer
impl StructuralPartialEq for NullBuffer
Auto Trait Implementations§
impl Freeze for NullBuffer
impl RefUnwindSafe for NullBuffer
impl Send for NullBuffer
impl Sync for NullBuffer
impl Unpin for NullBuffer
impl UnwindSafe for NullBuffer
Blanket Implementations§
Source§impl<T> AlignerFor<1> for T
impl<T> AlignerFor<1> for T
Source§impl<T> AlignerFor<1024> for T
impl<T> AlignerFor<1024> for T
Source§type Aligner = AlignTo1024<T>
type Aligner = AlignTo1024<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<128> for T
impl<T> AlignerFor<128> for T
Source§type Aligner = AlignTo128<T>
type Aligner = AlignTo128<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<16> for T
impl<T> AlignerFor<16> for T
Source§impl<T> AlignerFor<16384> for T
impl<T> AlignerFor<16384> for T
Source§type Aligner = AlignTo16384<T>
type Aligner = AlignTo16384<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<2> for T
impl<T> AlignerFor<2> for T
Source§impl<T> AlignerFor<2048> for T
impl<T> AlignerFor<2048> for T
Source§type Aligner = AlignTo2048<T>
type Aligner = AlignTo2048<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<256> for T
impl<T> AlignerFor<256> for T
Source§type Aligner = AlignTo256<T>
type Aligner = AlignTo256<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<32> for T
impl<T> AlignerFor<32> for T
Source§impl<T> AlignerFor<32768> for T
impl<T> AlignerFor<32768> for T
Source§type Aligner = AlignTo32768<T>
type Aligner = AlignTo32768<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<4> for T
impl<T> AlignerFor<4> for T
Source§impl<T> AlignerFor<4096> for T
impl<T> AlignerFor<4096> for T
Source§type Aligner = AlignTo4096<T>
type Aligner = AlignTo4096<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<512> for T
impl<T> AlignerFor<512> for T
Source§type Aligner = AlignTo512<T>
type Aligner = AlignTo512<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<64> for T
impl<T> AlignerFor<64> for T
Source§impl<T> AlignerFor<8> for T
impl<T> AlignerFor<8> for T
Source§impl<T> AlignerFor<8192> for T
impl<T> AlignerFor<8192> for T
Source§type Aligner = AlignTo8192<T>
type Aligner = AlignTo8192<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<'a, T> RCowCompatibleRef<'a> for Twhere
T: Clone + 'a,
impl<'a, T> RCowCompatibleRef<'a> for Twhere
T: Clone + 'a,
Source§fn as_c_ref(from: &'a T) -> <T as RCowCompatibleRef<'a>>::RefC
fn as_c_ref(from: &'a T) -> <T as RCowCompatibleRef<'a>>::RefC
Source§fn as_rust_ref(from: <T as RCowCompatibleRef<'a>>::RefC) -> &'a T
fn as_rust_ref(from: <T as RCowCompatibleRef<'a>>::RefC) -> &'a T
Source§impl<S> ROExtAcc for S
impl<S> ROExtAcc for S
Source§fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
offset. Read moreSource§fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
offset. Read moreSource§fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
offset. Read moreSource§fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
offset. Read moreSource§impl<S> ROExtOps<Aligned> for S
impl<S> ROExtOps<Aligned> for S
Source§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
offset) with value,
returning the previous value of the field. Read moreSource§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
Source§impl<S> ROExtOps<Unaligned> for S
impl<S> ROExtOps<Unaligned> for S
Source§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
offset) with value,
returning the previous value of the field. Read moreSource§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
Source§impl<T> SelfOps for Twhere
T: ?Sized,
impl<T> SelfOps for Twhere
T: ?Sized,
Source§fn piped<F, U>(self, f: F) -> U
fn piped<F, U>(self, f: F) -> U
Source§fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
piped except that the function takes &Self
Useful for functions that take &Self instead of Self. Read moreSource§fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
piped, except that the function takes &mut Self.
Useful for functions that take &mut Self instead of Self.Source§fn mutated<F>(self, f: F) -> Self
fn mutated<F>(self, f: F) -> Self
Source§fn observe<F>(self, f: F) -> Self
fn observe<F>(self, f: F) -> Self
Source§fn as_ref_<T>(&self) -> &T
fn as_ref_<T>(&self) -> &T
AsRef,
using the turbofish .as_ref_::<_>() syntax. Read more