RowSelection

Struct RowSelection 

Source
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 RowSelector with 0 rows
  • Consecutive RowSelectors alternate between skipping and selecting rows

Implementations§

Source§

impl RowSelection

Source

pub fn new() -> Self

Create a new empty RowSelection

Source

pub fn from_filters(filters: &[BooleanArray]) -> Self

Create a RowSelection from a slice of BooleanArray

§Panics

Panics if any of the BooleanArray contain nulls

Source

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
);
Source

pub fn select_all(row_count: usize) -> Self

Create a RowSelection that selects all row_count rows

Source

pub fn skip_all(row_count: usize) -> Self

Create a RowSelection that skips all row_count rows

Source

pub fn row_count(&self) -> usize

Returns the total number of rows (selected + skipped)

Source

pub fn selected_row_count(&self) -> usize

Returns the number of selected rows

Source

pub fn skipped_row_count(&self) -> usize

Returns the number of skipped rows

Source

pub fn selects_any(&self) -> bool

Returns true if this selection selects any rows

Source

pub fn iter(&self) -> impl Iterator<Item = &RowSelector>

Returns an iterator over the RowSelectors

Source

pub fn selectors(&self) -> &[RowSelector]

Returns a slice of the underlying RowSelectors

Source

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);
Source

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

Source§

fn clone(&self) -> RowSelection

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RowSelection

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for RowSelection

Source§

fn default() -> RowSelection

Returns the “default value” for a type. Read more
Source§

impl From<RowSelection> for Vec<RowSelector>

Source§

fn from(selection: RowSelection) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<RowSelector>> for RowSelection

Source§

fn from(selectors: Vec<RowSelector>) -> Self

Converts to this type from the input type.
Source§

impl FromIterator<RowSelector> for RowSelection

Source§

fn from_iter<T: IntoIterator<Item = RowSelector>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl PartialEq for RowSelection

Source§

fn eq(&self, other: &RowSelection) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for RowSelection

Source§

impl StructuralPartialEq for RowSelection

Auto Trait Implementations§

Blanket Implementations§

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
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

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

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

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