pub struct EquivalenceGroup {
pub classes: Vec<EquivalenceClass>,
}
Expand description
An EquivalenceGroup
is a collection of EquivalenceClass
es where each
class represents a distinct equivalence class in a relation.
Fields§
§classes: Vec<EquivalenceClass>
Implementations§
Source§impl EquivalenceGroup
impl EquivalenceGroup
Sourcepub fn new(classes: Vec<EquivalenceClass>) -> Self
pub fn new(classes: Vec<EquivalenceClass>) -> Self
Creates an equivalence group from the given equivalence classes.
Sourcepub fn iter(&self) -> impl Iterator<Item = &EquivalenceClass>
pub fn iter(&self) -> impl Iterator<Item = &EquivalenceClass>
Returns an iterator over the equivalence classes in this group.
Sourcepub fn add_equal_conditions(
&mut self,
left: &Arc<dyn PhysicalExpr>,
right: &Arc<dyn PhysicalExpr>,
)
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.
Sourcepub fn extend(&mut self, other: Self)
pub fn extend(&mut self, other: Self)
Extends this equivalence group with the other
equivalence group.
Sourcepub fn normalize_expr(
&self,
expr: Arc<dyn PhysicalExpr>,
) -> Arc<dyn PhysicalExpr>
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).
Sourcepub fn normalize_sort_expr(
&self,
sort_expr: PhysicalSortExpr,
) -> PhysicalSortExpr
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.
Sourcepub fn normalize_sort_requirement(
&self,
sort_requirement: PhysicalSortRequirement,
) -> PhysicalSortRequirement
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.
Sourcepub fn normalize_exprs(
&self,
exprs: impl IntoIterator<Item = Arc<dyn PhysicalExpr>>,
) -> Vec<Arc<dyn PhysicalExpr>>
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.
Sourcepub fn normalize_sort_exprs(
&self,
sort_exprs: LexOrderingRef<'_>,
) -> LexOrdering
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.
Sourcepub fn normalize_sort_requirements(
&self,
sort_reqs: LexRequirementRef<'_>,
) -> LexRequirement
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.
Sourcepub fn project_expr(
&self,
mapping: &ProjectionMapping,
expr: &Arc<dyn PhysicalExpr>,
) -> Option<Arc<dyn PhysicalExpr>>
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
.
Sourcepub fn project(&self, mapping: &ProjectionMapping) -> Self
pub fn project(&self, mapping: &ProjectionMapping) -> Self
Projects this equivalence group according to the given projection mapping.
Sourcepub fn join(
&self,
right_equivalences: &Self,
join_type: &JoinType,
left_size: usize,
on: &[(PhysicalExprRef, PhysicalExprRef)],
) -> Self
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
impl Clone for EquivalenceGroup
Source§fn clone(&self) -> EquivalenceGroup
fn clone(&self) -> EquivalenceGroup
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for EquivalenceGroup
impl Debug for EquivalenceGroup
Auto Trait Implementations§
impl Freeze for EquivalenceGroup
impl !RefUnwindSafe for EquivalenceGroup
impl Send for EquivalenceGroup
impl Sync for EquivalenceGroup
impl Unpin for EquivalenceGroup
impl !UnwindSafe for EquivalenceGroup
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,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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