Struct parquet::arrow::arrow_reader::RowSelection
source · pub struct RowSelection { /* private fields */ }
Expand description
RowSelection
allows selecting or skipping a provided number of rows
when scanning the parquet file.
This is applied prior to reading column data, and can therefore be used to skip IO to fetch data into memory
A typical use-case would be using the PageIndex
to filter out rows
that don’t satisfy a predicate
Example
use parquet::arrow::arrow_reader::{RowSelection, RowSelector};
let selectors = vec![
RowSelector { row_count: 5, skip: true },
RowSelector { row_count: 5, skip: false },
RowSelector { row_count: 5, skip: false },
RowSelector { row_count: 5, skip: true },
];
// Creating a selection will combine adjacent selectors
let selection: RowSelection = selectors.into();
let expected = vec![
RowSelector { row_count: 5, skip: true },
RowSelector { row_count: 10, skip: false },
RowSelector { row_count: 5, skip: true },
];
let actual: Vec<RowSelector> = selection.into();
assert_eq!(actual, expected);
Implementations§
source§impl RowSelection
impl RowSelection
sourcepub fn from_filters(filters: &[BooleanArray]) -> Self
pub fn from_filters(filters: &[BooleanArray]) -> Self
Creates a RowSelection
from a slice of BooleanArray
Panic
Panics if any of the BooleanArray
contain nulls
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
from this RowSelection
sourcepub fn and_then(&self, other: &Self) -> Self
pub fn and_then(&self, other: &Self) -> Self
Given a RowSelection
computed under self
, returns the RowSelection
representing their conjunction
For example:
self: NNNNNNNNNNNNYYYYYYYYYYYYYYYYYYYYYYNNNYYYYY other: YYYYYNNNNYYYYYYYYYYYYY YYNNN
returned: NNNNNNNNNNNNYYYYYNNNNYYYYYYYYYYYYYNNNYYNNN
Panics
Panics if other
does not have a length equal to the number of rows selected
by this RowSelection
sourcepub fn intersection(&self, other: &Self) -> Self
pub fn intersection(&self, other: &Self) -> Self
Compute the intersection of two RowSelection
For example:
self: NNYYYYNNYYNYN
other: NYNNNNNNY
returned: NNNNNNNNYYNYN
sourcepub fn selects_any(&self) -> bool
pub fn selects_any(&self) -> bool
Returns true
if this RowSelection
selects any rows
sourcepub fn iter(&self) -> impl Iterator<Item = &RowSelector>
pub fn iter(&self) -> impl Iterator<Item = &RowSelector>
Returns an iterator over the RowSelector
s for 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(r: RowSelection) -> Self
fn from(r: RowSelection) -> Self
source§impl From<RowSelection> for VecDeque<RowSelector>
impl From<RowSelection> for VecDeque<RowSelector>
source§fn from(r: RowSelection) -> Self
fn from(r: RowSelection) -> Self
source§impl From<Vec<RowSelector, Global>> for RowSelection
impl From<Vec<RowSelector, Global>> for RowSelection
source§fn from(selectors: Vec<RowSelector>) -> Self
fn from(selectors: Vec<RowSelector>) -> Self
source§impl PartialEq<RowSelection> for RowSelection
impl PartialEq<RowSelection> for RowSelection
source§fn eq(&self, other: &RowSelection) -> bool
fn eq(&self, other: &RowSelection) -> bool
self
and other
values to be equal, and is used
by ==
.