pub(super) struct RequiredIndices {
indices: Vec<usize>,
projection_beneficial: bool,
}Expand description
Represents columns in a schema which are required (used) by a plan node
Also carries a flag indicating if putting a projection above children is
beneficial for the parent. For example LogicalPlan::Filter benefits from
small tables. Hence for filter child this flag would be true. Defaults to
false
§Invariant
Indices are always in order and without duplicates. For example, if these
indices were added [3, 2, 4, 3, 6, 1], the instance would be represented
by [1, 2, 3, 4, 6].
Fields§
§indices: Vec<usize>The indices of the required columns in the
projection_beneficial: boolIf putting a projection above children is beneficial for the parent. Defaults to false.
Implementations§
Source§impl RequiredIndices
impl RequiredIndices
Sourcepub fn new_for_all_exprs(plan: &LogicalPlan) -> Self
pub fn new_for_all_exprs(plan: &LogicalPlan) -> Self
Create a new instance that requires all columns from the specified plan
Sourcepub fn new_from_indices(indices: Vec<usize>) -> Self
pub fn new_from_indices(indices: Vec<usize>) -> Self
Create a new instance with the specified indices as required
Sourcepub fn into_inner(self) -> Vec<usize>
pub fn into_inner(self) -> Vec<usize>
Convert the instance to its inner indices
Sourcepub fn with_projection_beneficial(self) -> Self
pub fn with_projection_beneficial(self) -> Self
Set the projection beneficial flag
Sourcepub fn projection_beneficial(&self) -> bool
pub fn projection_beneficial(&self) -> bool
Return the value of projection beneficial flag
Sourcepub fn with_plan_exprs(
self,
plan: &LogicalPlan,
schema: &DFSchemaRef,
) -> Result<Self>
pub fn with_plan_exprs( self, plan: &LogicalPlan, schema: &DFSchemaRef, ) -> Result<Self>
Add required indices for all exprs used in plan
Sourcefn add_expr(&mut self, input_schema: &DFSchemaRef, expr: &Expr)
fn add_expr(&mut self, input_schema: &DFSchemaRef, expr: &Expr)
Adds the indices of the fields referred to by the given expression
expr within the given schema (input_schema).
Self is NOT compacted (and thus this method is not pub)
§Parameters
input_schema: The input schema to analyze for index requirements.expr: An expression for which we want to find necessary field indices.
Sourcepub fn with_exprs<'a>(
self,
schema: &DFSchemaRef,
exprs: impl IntoIterator<Item = &'a Expr>,
) -> Self
pub fn with_exprs<'a>( self, schema: &DFSchemaRef, exprs: impl IntoIterator<Item = &'a Expr>, ) -> Self
Adds the indices of the fields referred to by the given expressions `within the given schema.
§Parameters
input_schema: The input schema to analyze for index requirements.exprs: the expressions for which we want to find field indices.
Sourcepub fn split_off(self, n: usize) -> (Self, Self)
pub fn split_off(self, n: usize) -> (Self, Self)
Splits this instance into a tuple with two instances:
- The first
nindices - The remaining indices, adjusted down by n
Sourcefn partition<F>(&self, f: F) -> (Self, Self)
fn partition<F>(&self, f: F) -> (Self, Self)
Partitions the indices in this instance into two groups based on the
given predicate function f.
Sourcefn map_indices<F>(self, f: F) -> Self
fn map_indices<F>(self, f: F) -> Self
Map the indices in this instance to a new set of indices based on the
given function f, returning the mapped indices
Not pub as it might not preserve the invariant of compacted indices
Sourcepub fn into_mapped_indices<F>(self, f: F) -> Vec<usize>
pub fn into_mapped_indices<F>(self, f: F) -> Vec<usize>
Apply the given function f to each index in this instance, returning
the mapped indices
Sourcepub fn get_at_indices(&self, exprs: &[Expr]) -> Vec<Expr>
pub fn get_at_indices(&self, exprs: &[Expr]) -> Vec<Expr>
Returns the Exprs from exprs that are at the indices in this instance
Sourcepub fn get_required_exprs(&self, input_schema: &DFSchemaRef) -> Vec<Expr>
pub fn get_required_exprs(&self, input_schema: &DFSchemaRef) -> Vec<Expr>
Generates the required expressions (columns) that reside at indices of
the given input_schema.
Trait Implementations§
Source§impl Clone for RequiredIndices
impl Clone for RequiredIndices
Source§fn clone(&self) -> RequiredIndices
fn clone(&self) -> RequiredIndices
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RequiredIndices
impl Debug for RequiredIndices
Source§impl Default for RequiredIndices
impl Default for RequiredIndices
Source§fn default() -> RequiredIndices
fn default() -> RequiredIndices
Auto Trait Implementations§
impl Freeze for RequiredIndices
impl RefUnwindSafe for RequiredIndices
impl Send for RequiredIndices
impl Sync for RequiredIndices
impl Unpin for RequiredIndices
impl UnwindSafe for RequiredIndices
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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