datafusion_physical_expr::equivalence

Struct EquivalenceGroup

Source
pub struct EquivalenceGroup {
    pub classes: Vec<EquivalenceClass>,
}
Expand description

An EquivalenceGroup is a collection of EquivalenceClasses where each class represents a distinct equivalence class in a relation.

Fields§

§classes: Vec<EquivalenceClass>

Implementations§

Source§

impl EquivalenceGroup

Source

pub fn empty() -> Self

Creates an empty equivalence group.

Source

pub fn new(classes: Vec<EquivalenceClass>) -> Self

Creates an equivalence group from the given equivalence classes.

Source

pub fn len(&self) -> usize

Returns how many equivalence classes there are in this group.

Source

pub fn is_empty(&self) -> bool

Checks whether this equivalence group is empty.

Source

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

Returns an iterator over the equivalence classes in this group.

Source

pub fn add_equal_conditions( &mut self, left: &Arc<dyn PhysicalExpr>, right: &Arc<dyn PhysicalExpr>, )

Adds the equality left = right to this equivalence group. New equality conditions often arise after steps like Filter(a = b), Alias(a, a as b) etc.

Source

pub fn extend(&mut self, other: Self)

Extends this equivalence group with the other equivalence group.

Source

pub fn normalize_expr( &self, expr: Arc<dyn PhysicalExpr>, ) -> Arc<dyn PhysicalExpr>

Normalizes the given physical expression according to this group. The expression is replaced with the first expression in the equivalence class it matches with (if any).

Source

pub fn normalize_sort_expr( &self, sort_expr: PhysicalSortExpr, ) -> PhysicalSortExpr

Normalizes the given sort expression according to this group. The underlying physical expression is replaced with the first expression in the equivalence class it matches with (if any). If the underlying expression does not belong to any equivalence class in this group, returns the sort expression as is.

Source

pub fn normalize_sort_requirement( &self, sort_requirement: PhysicalSortRequirement, ) -> PhysicalSortRequirement

Normalizes the given sort requirement according to this group. The underlying physical expression is replaced with the first expression in the equivalence class it matches with (if any). If the underlying expression does not belong to any equivalence class in this group, returns the given sort requirement as is.

Source

pub fn normalize_exprs( &self, exprs: impl IntoIterator<Item = Arc<dyn PhysicalExpr>>, ) -> Vec<Arc<dyn PhysicalExpr>>

This function applies the normalize_expr function for all expressions in exprs and returns the corresponding normalized physical expressions.

Source

pub fn normalize_sort_exprs( &self, sort_exprs: LexOrderingRef<'_>, ) -> LexOrdering

This function applies the normalize_sort_expr function for all sort expressions in sort_exprs and returns the corresponding normalized sort expressions.

Source

pub fn normalize_sort_requirements( &self, sort_reqs: LexRequirementRef<'_>, ) -> LexRequirement

This function applies the normalize_sort_requirement function for all requirements in sort_reqs and returns the corresponding normalized sort requirements.

Source

pub fn project_expr( &self, mapping: &ProjectionMapping, expr: &Arc<dyn PhysicalExpr>, ) -> Option<Arc<dyn PhysicalExpr>>

Projects expr according to the given projection mapping. If the resulting expression is invalid after projection, returns None.

Source

pub fn project(&self, mapping: &ProjectionMapping) -> Self

Projects this equivalence group according to the given projection mapping.

Source

pub fn join( &self, right_equivalences: &Self, join_type: &JoinType, left_size: usize, on: &[(PhysicalExprRef, PhysicalExprRef)], ) -> Self

Combine equivalence groups of the given join children.

Trait Implementations§

Source§

impl Clone for EquivalenceGroup

Source§

fn clone(&self) -> EquivalenceGroup

Returns a copy 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 EquivalenceGroup

Source§

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

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

impl Display for EquivalenceGroup

Source§

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

Formats the value using the given formatter. 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, dst: *mut T)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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
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> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.