pub struct RowAddrTreeMap { /* private fields */ }Expand description
A collection of row addresses.
Note: For stable row id mode, this may be split into a separate structure in the future.
These row ids may either be stable-style (where they can be an incrementing u64 sequence) or address style, where they are a fragment id and a row offset. When address style, this supports setting entire fragments as selected, without needing to enumerate all the ids in the fragment.
This is similar to a RoaringTreemap but it is optimized for the case where entire fragments are selected or deselected.
Implementations§
Source§impl RowAddrTreeMap
impl RowAddrTreeMap
Sourcepub fn row_addrs(&self) -> Option<impl Iterator<Item = RowAddress> + '_>
pub fn row_addrs(&self) -> Option<impl Iterator<Item = RowAddress> + '_>
An iterator of row addrs
If there are any “full fragment” items then this can’t be calculated and None is returned
Sourcepub fn insert(&mut self, value: u64) -> bool
pub fn insert(&mut self, value: u64) -> bool
Insert a single value into the set
Returns true if the value was not already in the set.
use lance_core::utils::mask::{RowAddrTreeMap, RowSetOps};
let mut set = RowAddrTreeMap::new();
assert_eq!(set.insert(10), true);
assert_eq!(set.insert(10), false);
assert_eq!(set.contains(10), true);Sourcepub fn insert_range<R: RangeBounds<u64>>(&mut self, range: R) -> u64
pub fn insert_range<R: RangeBounds<u64>>(&mut self, range: R) -> u64
Insert a range of values into the set
Sourcepub fn insert_bitmap(&mut self, fragment: u32, bitmap: RoaringBitmap)
pub fn insert_bitmap(&mut self, fragment: u32, bitmap: RoaringBitmap)
Add a bitmap for a single fragment
Sourcepub fn insert_fragment(&mut self, fragment_id: u32)
pub fn insert_fragment(&mut self, fragment_id: u32)
Add a whole fragment to the set
pub fn get_fragment_bitmap(&self, fragment_id: u32) -> Option<&RoaringBitmap>
pub fn retain_fragments(&mut self, frag_ids: impl IntoIterator<Item = u32>)
Sourcepub fn serialized_size(&self) -> usize
pub fn serialized_size(&self) -> usize
Compute the serialized size of the set.
Sourcepub fn serialize_into<W: Write>(&self, writer: W) -> Result<()>
pub fn serialize_into<W: Write>(&self, writer: W) -> Result<()>
Serialize the set into the given buffer
The serialization format is stable and used for index serialization
The serialization format is:
- u32: num_entries
for each entry:
- u32: fragment_id
- u32: bitmap size
- [u8]: bitmap
If bitmap size is zero then the entire fragment is selected.
Sourcepub fn deserialize_from<R: Read>(reader: R) -> Result<Self>
pub fn deserialize_from<R: Read>(reader: R) -> Result<Self>
Deserialize the set from the given buffer
Sourcepub fn mask(&mut self, mask: &RowAddrMask)
pub fn mask(&mut self, mask: &RowAddrMask)
Apply a mask to the row addrs
For AllowList: only keep rows that are in the selection and not null For BlockList: remove rows that are blocked (not null) and remove nulls
Sourcepub unsafe fn into_addr_iter(self) -> impl Iterator<Item = u64>
pub unsafe fn into_addr_iter(self) -> impl Iterator<Item = u64>
Convert the set into an iterator of row addrs
§Safety
This is unsafe because if any of the inner RowAddrSelection elements is not a Partial then the iterator will panic because we don’t know the size of the bitmap.
Trait Implementations§
Source§impl BitAnd<&RowAddrTreeMap> for RowAddrTreeMap
impl BitAnd<&RowAddrTreeMap> for RowAddrTreeMap
Source§impl BitAnd for RowAddrTreeMap
impl BitAnd for RowAddrTreeMap
Source§impl BitAndAssign<&RowAddrTreeMap> for RowAddrTreeMap
impl BitAndAssign<&RowAddrTreeMap> for RowAddrTreeMap
Source§fn bitand_assign(&mut self, rhs: &Self)
fn bitand_assign(&mut self, rhs: &Self)
&= operation. Read moreSource§impl BitAndAssign for RowAddrTreeMap
impl BitAndAssign for RowAddrTreeMap
Source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
&= operation. Read moreSource§impl BitOr<&RowAddrTreeMap> for RowAddrTreeMap
impl BitOr<&RowAddrTreeMap> for RowAddrTreeMap
Source§impl BitOr for RowAddrTreeMap
impl BitOr for RowAddrTreeMap
Source§impl BitOrAssign<&RowAddrTreeMap> for RowAddrTreeMap
impl BitOrAssign<&RowAddrTreeMap> for RowAddrTreeMap
Source§fn bitor_assign(&mut self, rhs: &Self)
fn bitor_assign(&mut self, rhs: &Self)
|= operation. Read moreSource§impl BitOrAssign for RowAddrTreeMap
impl BitOrAssign for RowAddrTreeMap
Source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
|= operation. Read moreSource§impl Clone for RowAddrTreeMap
impl Clone for RowAddrTreeMap
Source§fn clone(&self) -> RowAddrTreeMap
fn clone(&self) -> RowAddrTreeMap
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RowAddrTreeMap
impl Debug for RowAddrTreeMap
Source§impl DeepSizeOf for RowAddrTreeMap
impl DeepSizeOf for RowAddrTreeMap
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
Source§impl Default for RowAddrTreeMap
impl Default for RowAddrTreeMap
Source§fn default() -> RowAddrTreeMap
fn default() -> RowAddrTreeMap
Source§impl<'a> Extend<&'a u64> for RowAddrTreeMap
impl<'a> Extend<&'a u64> for RowAddrTreeMap
Source§fn extend<T: IntoIterator<Item = &'a u64>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = &'a u64>>(&mut self, iter: T)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl Extend<RowAddrTreeMap> for RowAddrTreeMap
impl Extend<RowAddrTreeMap> for RowAddrTreeMap
Source§fn extend<T: IntoIterator<Item = Self>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Self>>(&mut self, iter: T)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl Extend<u64> for RowAddrTreeMap
impl Extend<u64> for RowAddrTreeMap
Source§fn extend<T: IntoIterator<Item = u64>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = u64>>(&mut self, iter: T)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl From<RangeInclusive<u64>> for RowAddrTreeMap
impl From<RangeInclusive<u64>> for RowAddrTreeMap
Source§fn from(range: RangeInclusive<u64>) -> Self
fn from(range: RangeInclusive<u64>) -> Self
Source§impl From<RoaringTreemap> for RowAddrTreeMap
impl From<RoaringTreemap> for RowAddrTreeMap
Source§fn from(roaring: RoaringTreemap) -> Self
fn from(roaring: RoaringTreemap) -> Self
Source§impl<'a> FromIterator<&'a u64> for RowAddrTreeMap
impl<'a> FromIterator<&'a u64> for RowAddrTreeMap
Source§impl FromIterator<u64> for RowAddrTreeMap
impl FromIterator<u64> for RowAddrTreeMap
Source§impl PartialEq for RowAddrTreeMap
impl PartialEq for RowAddrTreeMap
Source§impl RowSetOps for RowAddrTreeMap
impl RowSetOps for RowAddrTreeMap
Source§fn from_sorted_iter<I>(iter: I) -> Result<Self>where
I: IntoIterator<Item = Self::Row>,
fn from_sorted_iter<I>(iter: I) -> Result<Self>where
I: IntoIterator<Item = Self::Row>,
Source§impl Sub<&RowAddrTreeMap> for RowAddrTreeMap
impl Sub<&RowAddrTreeMap> for RowAddrTreeMap
Source§impl Sub for RowAddrTreeMap
impl Sub for RowAddrTreeMap
Source§impl SubAssign<&RowAddrTreeMap> for RowAddrTreeMap
impl SubAssign<&RowAddrTreeMap> for RowAddrTreeMap
Source§fn sub_assign(&mut self, rhs: &Self)
fn sub_assign(&mut self, rhs: &Self)
-= operation. Read moreimpl StructuralPartialEq for RowAddrTreeMap
Auto Trait Implementations§
impl Freeze for RowAddrTreeMap
impl RefUnwindSafe for RowAddrTreeMap
impl Send for RowAddrTreeMap
impl Sync for RowAddrTreeMap
impl Unpin for RowAddrTreeMap
impl UnwindSafe for RowAddrTreeMap
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