pub struct RowIdMask {
pub allow_list: Option<RowIdTreeMap>,
pub block_list: Option<RowIdTreeMap>,
}
Expand description
A row id mask to select or deselect particular row ids
If both the allow_list and the block_list are Some then the only selected row ids are those that are in the allow_list but not in the block_list (the block_list takes precedence)
If both the allow_list and the block_list are None (the default) then all row ids are selected
Fields§
§allow_list: Option<RowIdTreeMap>
If Some then only these row ids are selected
block_list: Option<RowIdTreeMap>
If Some then these row ids are not selected.
Implementations§
Source§impl RowIdMask
impl RowIdMask
pub fn all_rows() -> Self
pub fn allow_nothing() -> Self
pub fn from_allowed(allow_list: RowIdTreeMap) -> Self
pub fn from_block(block_list: RowIdTreeMap) -> Self
Sourcepub fn selected(&self, row_id: u64) -> bool
pub fn selected(&self, row_id: u64) -> bool
True if the row_id is selected by the mask, false otherwise
Sourcepub fn selected_indices<'a>(
&self,
row_ids: impl Iterator<Item = &'a u64> + 'a,
) -> Vec<u64>
pub fn selected_indices<'a>( &self, row_ids: impl Iterator<Item = &'a u64> + 'a, ) -> Vec<u64>
Return the indices of the input row ids that were valid
Sourcepub fn also_block(self, block_list: RowIdTreeMap) -> Self
pub fn also_block(self, block_list: RowIdTreeMap) -> Self
Also block the given ids
Sourcepub fn also_allow(self, allow_list: RowIdTreeMap) -> Self
pub fn also_allow(self, allow_list: RowIdTreeMap) -> Self
Also allow the given ids
Sourcepub fn into_arrow(&self) -> Result<BinaryArray>
pub fn into_arrow(&self) -> Result<BinaryArray>
Convert a mask into an arrow array
A row id mask is not very arrow-compatible. We can’t make it a batch with two columns because the block list and allow list will have different lengths. Also, there is no Arrow type for compressed bitmaps.
However, we need to shove it into some kind of Arrow container to pass it along the datafusion stream. Perhaps, in the future, we can add row id masks as first class types in datafusion, and this can be passed along as a mask / selection vector.
We serialize this as a variable length binary array with two items. The first item is the block list and the second item is the allow list.
Sourcepub fn from_arrow(array: &GenericBinaryArray<i32>) -> Result<Self>
pub fn from_arrow(array: &GenericBinaryArray<i32>) -> Result<Self>
Deserialize a row id mask from Arrow
Trait Implementations§
Source§impl DeepSizeOf for RowIdMask
impl DeepSizeOf for RowIdMask
Source§fn deep_size_of_children(&self, context: &mut Context) -> usize
fn deep_size_of_children(&self, context: &mut Context) -> usize
Source§fn deep_size_of(&self) -> usize
fn deep_size_of(&self) -> usize
Auto Trait Implementations§
impl Freeze for RowIdMask
impl RefUnwindSafe for RowIdMask
impl Send for RowIdMask
impl Sync for RowIdMask
impl Unpin for RowIdMask
impl UnwindSafe for RowIdMask
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> 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 more