pub enum Validity {
AllValid,
AllInvalid,
Mask(Bitmap),
}Expand description
Which values in a vector are valid.
Variants§
AllValid
Nothing is null. No mask is stored and the kernels that read this take the fast path.
AllInvalid
Everything is null. Most operators can answer without looking at the data at all.
Mask(Bitmap)
Some of each, one bit per value, set meaning valid.
Implementations§
Source§impl Validity
impl Validity
Sourcepub fn is_valid(&self, index: usize) -> bool
pub fn is_valid(&self, index: usize) -> bool
Whether the value at index is not null.
Out of range reads report invalid rather than panicking, because this is called from kernels that are allowed to read past the end of a partially filled vector.
Sourcepub fn count_valid(&self, len: usize) -> usize
pub fn count_valid(&self, len: usize) -> usize
How many of the first len values are not null.
Sourcepub fn normalize(self, len: usize) -> Self
pub fn normalize(self, len: usize) -> Self
Collapses a mask that turned out to be uniform back to one of the flag cases.
Worth doing at the end of any operation that builds a mask, because every kernel downstream then gets to take the branch it wants rather than walking a bitmap to find out what it already could have been told.
Sourcepub fn with_null(self, index: usize, len: usize) -> Self
pub fn with_null(self, index: usize, len: usize) -> Self
The validity of a vector where index has just been made null.
Takes and returns by value because setting a null on an AllValid vector has to
materialize a mask, and hiding that behind &mut self hides an allocation.