pub struct RowSelection { /* private fields */ }Expand description
RowSelection allows selecting or skipping rows when scanning an ORC file.
This is applied prior to reading column data, and can therefore be used to skip IO to fetch data into memory, improving query performance.
A typical use-case would be using ORC stripe statistics or file-level indexes to filter out rows that don’t satisfy a predicate.
§Example
use orc_rust::row_selection::{RowSelection, RowSelector};
// Create selectors: skip 100 rows, select 50, skip 200
let selectors = vec![
    RowSelector::skip(100),
    RowSelector::select(50),
    RowSelector::skip(200),
];
let selection: RowSelection = selectors.into();
// Query properties
assert_eq!(selection.row_count(), 350);
assert_eq!(selection.selects_any(), true);A RowSelection maintains the following invariants:
- It contains no RowSelectorwith 0 rows
- Consecutive RowSelectors alternate between skipping and selecting rows
Implementations§
Source§impl RowSelection
 
impl RowSelection
Sourcepub fn new() -> Self
 
pub fn new() -> Self
Create a new empty RowSelection
Sourcepub fn from_filters(filters: &[BooleanArray]) -> Self
 
pub fn from_filters(filters: &[BooleanArray]) -> Self
Create a RowSelection from a slice of BooleanArray
§Panics
Panics if any of the BooleanArray contain nulls
Sourcepub fn from_consecutive_ranges<I: Iterator<Item = Range<usize>>>(
    ranges: I,
    total_rows: usize,
) -> Self
 
pub fn from_consecutive_ranges<I: Iterator<Item = Range<usize>>>( ranges: I, total_rows: usize, ) -> Self
Create a RowSelection from an iterator of consecutive ranges to keep
§Arguments
- ranges- Iterator of consecutive ranges (e.g.,- 10..20,- 30..40)
- total_rows- Total number of rows in the stripe/file
§Example
use orc_rust::row_selection::RowSelection;
// Select rows 10-19 and 30-39 out of 50 total rows
let selection = RowSelection::from_consecutive_ranges(
    vec![10..20, 30..40].into_iter(),
    50
);Sourcepub fn select_all(row_count: usize) -> Self
 
pub fn select_all(row_count: usize) -> Self
Create a RowSelection that selects all row_count rows
Sourcepub fn skip_all(row_count: usize) -> Self
 
pub fn skip_all(row_count: usize) -> Self
Create a RowSelection that skips all row_count rows
Sourcepub fn selected_row_count(&self) -> usize
 
pub fn selected_row_count(&self) -> usize
Returns the number of selected rows
Sourcepub fn skipped_row_count(&self) -> usize
 
pub fn skipped_row_count(&self) -> usize
Returns the number of skipped rows
Sourcepub fn selects_any(&self) -> bool
 
pub fn selects_any(&self) -> bool
Returns true if this selection selects any rows
Sourcepub fn iter(&self) -> impl Iterator<Item = &RowSelector>
 
pub fn iter(&self) -> impl Iterator<Item = &RowSelector>
Returns an iterator over the RowSelectors
Sourcepub fn selectors(&self) -> &[RowSelector]
 
pub fn selectors(&self) -> &[RowSelector]
Returns a slice of the underlying RowSelectors
Sourcepub fn split_off(&mut self, row_count: usize) -> Self
 
pub fn split_off(&mut self, row_count: usize) -> Self
Splits off the first row_count rows from this RowSelection
Returns a new RowSelection containing the first row_count rows,
and updates self to contain the remaining rows.
§Example
use orc_rust::row_selection::{RowSelection, RowSelector};
let mut selection = RowSelection::from_consecutive_ranges(
    vec![10..20, 30..40].into_iter(),
    50
);
let first = selection.split_off(25);
assert_eq!(first.row_count(), 25);
assert_eq!(selection.row_count(), 25);Sourcepub fn and_then(&self, other: &Self) -> Self
 
pub fn and_then(&self, other: &Self) -> Self
Combine two RowSelections using logical AND
Returns a new RowSelection representing rows that are selected
in both input selections.
§Panics
Panics if other does not have a length equal to the number of rows
selected by this RowSelection
Trait Implementations§
Source§impl Clone for RowSelection
 
impl Clone for RowSelection
Source§fn clone(&self) -> RowSelection
 
fn clone(&self) -> RowSelection
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RowSelection
 
impl Debug for RowSelection
Source§impl Default for RowSelection
 
impl Default for RowSelection
Source§fn default() -> RowSelection
 
fn default() -> RowSelection
Source§impl From<RowSelection> for Vec<RowSelector>
 
impl From<RowSelection> for Vec<RowSelector>
Source§fn from(selection: RowSelection) -> Self
 
fn from(selection: RowSelection) -> Self
Source§impl From<Vec<RowSelector>> for RowSelection
 
impl From<Vec<RowSelector>> for RowSelection
Source§fn from(selectors: Vec<RowSelector>) -> Self
 
fn from(selectors: Vec<RowSelector>) -> Self
Source§impl FromIterator<RowSelector> for RowSelection
 
impl FromIterator<RowSelector> for RowSelection
Source§fn from_iter<T: IntoIterator<Item = RowSelector>>(iter: T) -> Self
 
fn from_iter<T: IntoIterator<Item = RowSelector>>(iter: T) -> Self
Source§impl PartialEq for RowSelection
 
impl PartialEq for RowSelection
impl Eq for RowSelection
impl StructuralPartialEq for RowSelection
Auto Trait Implementations§
impl Freeze for RowSelection
impl RefUnwindSafe for RowSelection
impl Send for RowSelection
impl Sync for RowSelection
impl Unpin for RowSelection
impl UnwindSafe for RowSelection
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<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.