Skip to main content

MaskCursor

Struct MaskCursor 

Source
pub struct MaskCursor {
    mask: BooleanBuffer,
    position: usize,
    loaded_row_ranges: Option<Arc<LoadedRowRanges>>,
}
Expand description

Cursor for iterating a mask-backed RowSelection

This is best for dense selections where there are many small skips or selections. For example, selecting every other row.

When page pruning produces sparse column data, loaded_row_ranges limits each decoded chunk to rows whose pages are loaded for every projected leaf. For example, two projected columns can have different page boundaries:

Row ranges:       [0, 4) [4, 6) [6, 8) [8, 10) [10, 12)
Selection mask:   1000   00     00     00      01
Column A pages:   loaded | missing [4, 8) | loaded [8, 12)
Column B pages:   loaded [0, 6) | missing [6, 10) | loaded
LoadedRowRanges:  [0, 4)                         [10, 12)

The first chunk decodes [0, 1) with mask 1. The next chunk skips to row 11 and decodes [11, 12) with mask 1. When loaded ranges are present, every returned chunk ends at a selected row and never includes trailing unselected rows. ParquetRecordBatchReader still accumulates both chunks and applies the combined mask 11 once.

Fields§

§mask: BooleanBuffer§position: usize

Current absolute offset into the selection

§loaded_row_ranges: Option<Arc<LoadedRowRanges>>

Row ranges whose backing pages are loaded for every projected column.

Implementations§

Source§

impl MaskCursor

Source

pub fn is_empty(&self) -> bool

Returns true when no further rows remain

Source

pub fn next_mask_chunk(&mut self, batch_size: usize) -> Option<MaskChunk>

Advance through the mask representation, producing the next chunk summary

Source

fn next_mask_chunk_non_empty(&mut self, batch_size: usize) -> MaskChunk

Produces the next chunk for a non-empty, trailing-skip-free mask.

Source

pub(crate) fn next_chunk( &mut self, batch_size: usize, ) -> Result<MaskChunk, ParquetError>

Returns the next non-empty mask chunk without crossing an unloaded row range. When loaded ranges are present, every returned chunk ends immediately after a selected row and therefore never contains trailing unselected rows. Those rows remain for the next call’s initial skip.

The ReadPlan removes trailing skips before constructing this cursor. Callers therefore only invoke this method for a non-empty mask that has another selected row.

Source

pub fn mask_values_for( &self, chunk: &MaskChunk, ) -> Result<BooleanArray, ParquetError>

Materialise the boolean values for a mask-backed chunk

Trait Implementations§

Source§

impl Debug for MaskCursor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Ungil for T
where T: Send,