RequiredIndices

Struct RequiredIndices 

Source
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: bool

If putting a projection above children is beneficial for the parent. Defaults to false.

Implementations§

Source§

impl RequiredIndices

Source

pub fn new() -> Self

Create a new, empty instance

Source

pub fn new_for_all_exprs(plan: &LogicalPlan) -> Self

Create a new instance that requires all columns from the specified plan

Source

pub fn new_from_indices(indices: Vec<usize>) -> Self

Create a new instance with the specified indices as required

Source

pub fn into_inner(self) -> Vec<usize>

Convert the instance to its inner indices

Source

pub fn with_projection_beneficial(self) -> Self

Set the projection beneficial flag

Source

pub fn projection_beneficial(&self) -> bool

Return the value of projection beneficial flag

Source

pub fn indices(&self) -> &[usize]

Return a reference to the underlying indices

Source

pub fn with_plan_exprs( self, plan: &LogicalPlan, schema: &DFSchemaRef, ) -> Result<Self>

Add required indices for all exprs used in plan

Source

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

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

pub fn append(self, indices: &[usize]) -> Self

Adds all indices into this instance.

Source

pub fn split_off(self, n: usize) -> (Self, Self)

Splits this instance into a tuple with two instances:

  • The first n indices
  • The remaining indices, adjusted down by n
Source

fn partition<F>(&self, f: F) -> (Self, Self)
where F: Fn(usize) -> bool,

Partitions the indices in this instance into two groups based on the given predicate function f.

Source

fn map_indices<F>(self, f: F) -> Self
where F: Fn(usize) -> usize,

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

Source

pub fn into_mapped_indices<F>(self, f: F) -> Vec<usize>
where F: Fn(usize) -> usize,

Apply the given function f to each index in this instance, returning the mapped indices

Source

pub fn get_at_indices(&self, exprs: &[Expr]) -> Vec<Expr>

Returns the Exprs from exprs that are at the indices in this instance

Source

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.

Source

fn compact(self) -> Self

Compacts the indices of this instance so they are sorted (ascending) and deduplicated.

Trait Implementations§

Source§

impl Clone for RequiredIndices

Source§

fn clone(&self) -> RequiredIndices

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 RequiredIndices

Source§

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

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

impl Default for RequiredIndices

Source§

fn default() -> RequiredIndices

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

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

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

§

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
§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

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

§

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