pub enum AdaptiveSelection {
Empty {
nrows: usize,
},
All {
nrows: usize,
},
SelectionVector {
rows: Vec<u32>,
nrows: usize,
},
VerbatimMask {
mask: BitMask,
},
Hybrid {
nrows: usize,
chunks: Vec<HybridChunk>,
},
}Expand description
A row-selection representation chosen adaptively by density.
All variants carry nrows (the size of the underlying DataFrame) so that
count/contains/iteration are answerable without consulting the base.
Variants§
Empty
No rows selected. nrows is the underlying frame size.
All
Every row selected.
SelectionVector
Sparse: ascending u32 row indices.
VerbatimMask
Dense: backing BitMask.
Hybrid
Mid-density chunked representation. chunks.len() == ceil(nrows / HYBRID_CHUNK_SIZE).
Implementations§
Source§impl AdaptiveSelection
impl AdaptiveSelection
Sourcepub fn from_bitmask(mask: BitMask) -> Self
pub fn from_bitmask(mask: BitMask) -> Self
Wrap a BitMask directly (force the dense arm). Used by call sites
that already produced a mask through the existing pipeline and do
not want a re-classification.
Sourcepub fn from_predicate_result(words: Vec<u64>, nrows: usize) -> Self
pub fn from_predicate_result(words: Vec<u64>, nrows: usize) -> Self
Construct from raw predicate-result words (LSB-first within each u64).
This is the canonical entry point from try_eval_predicate_columnar
and the row-wise filter fallback. The classifier:
- Counts set bits across
words. - Picks
Empty/All/SelectionVector/VerbatimMaskper density. - Mid-band selections become
Hybridwhennrows >= 2 * HYBRID_CHUNK_SIZE.
The caller is responsible for masking off tail bits past nrows before
invoking — BitMask::all_true / BitMask::from_bools and the
columnar predicate path already do this.
Sourcepub fn from_words_with_count(
words: Vec<u64>,
nrows: usize,
count: usize,
) -> Self
pub fn from_words_with_count( words: Vec<u64>, nrows: usize, count: usize, ) -> Self
Test-only and conversion helper — same as from_predicate_result but
caller already knows the count.
Sourcepub fn contains(&self, row: usize) -> bool
pub fn contains(&self, row: usize) -> bool
True if row is in the selection. Out-of-range rows return false.
Sourcepub fn iter_indices(&self) -> SelectionIndices<'_> ⓘ
pub fn iter_indices(&self) -> SelectionIndices<'_> ⓘ
Iterate selected rows in ascending order.
Sourcepub fn materialize_mask(&self) -> BitMask
pub fn materialize_mask(&self) -> BitMask
Materialize the selection as a BitMask. Always allocates O(nrows/64).
Sourcepub fn materialize_indices(&self) -> Vec<u32>
pub fn materialize_indices(&self) -> Vec<u32>
Materialize the selection as an ascending Vec<u32> of row indices.
Sourcepub fn intersect(&self, other: &AdaptiveSelection) -> AdaptiveSelection
pub fn intersect(&self, other: &AdaptiveSelection) -> AdaptiveSelection
Intersection (AND). Output mode is re-classified by density.
Panics if nrows differ — programming error (different base frames).
Sourcepub fn union(&self, other: &AdaptiveSelection) -> AdaptiveSelection
pub fn union(&self, other: &AdaptiveSelection) -> AdaptiveSelection
Union (OR). Output mode re-classified by density.
Sourcepub fn explain_selection_mode(&self) -> &'static str
pub fn explain_selection_mode(&self) -> &'static str
Stable identifier of the chosen mode. Useful for debug, tests, and
the planned explain_selection_mode user-facing call.
Trait Implementations§
Source§impl Clone for AdaptiveSelection
impl Clone for AdaptiveSelection
Source§fn clone(&self) -> AdaptiveSelection
fn clone(&self) -> AdaptiveSelection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AdaptiveSelection
impl Debug for AdaptiveSelection
Source§impl PartialEq for AdaptiveSelection
impl PartialEq for AdaptiveSelection
Source§fn eq(&self, other: &AdaptiveSelection) -> bool
fn eq(&self, other: &AdaptiveSelection) -> bool
self and other values to be equal, and is used by ==.impl Eq for AdaptiveSelection
impl StructuralPartialEq for AdaptiveSelection
Auto Trait Implementations§
impl Freeze for AdaptiveSelection
impl RefUnwindSafe for AdaptiveSelection
impl Send for AdaptiveSelection
impl Sync for AdaptiveSelection
impl Unpin for AdaptiveSelection
impl UnsafeUnpin for AdaptiveSelection
impl UnwindSafe for AdaptiveSelection
Blanket Implementations§
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<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 more