pub struct EquivalenceClass { /* private fields */ }Expand description
An EquivalenceClass is a set of Arc<dyn PhysicalExpr>s that are known
to have the same value for all tuples in a relation. These are generated by
equality predicates (e.g. a = b), typically equi-join conditions and
equality conditions in filters.
Two EquivalenceClasses are equal if they contains the same expressions in
without any ordering.
Implementations§
Source§impl EquivalenceClass
impl EquivalenceClass
pub fn new(exprs: impl IntoIterator<Item = Arc<dyn PhysicalExpr>>) -> Self
Sourcepub fn canonical_expr(&self) -> Option<&Arc<dyn PhysicalExpr>>
pub fn canonical_expr(&self) -> Option<&Arc<dyn PhysicalExpr>>
Return the “canonical” expression for this class (the first element) if non-empty.
Sourcepub fn push(&mut self, expr: Arc<dyn PhysicalExpr>)
pub fn push(&mut self, expr: Arc<dyn PhysicalExpr>)
Insert the expression into this class, meaning it is known to be equal to all other expressions in this class.
Sourcepub fn contains_any(&self, other: &Self) -> bool
pub fn contains_any(&self, other: &Self) -> bool
Returns whether this equivalence class has any entries in common with
other.
Sourcepub fn is_trivial(&self) -> bool
pub fn is_trivial(&self) -> bool
Returns whether this equivalence class is trivial, meaning that it is either empty, or contains a single expression that is not a constant. Such classes are not useful, and can be removed from equivalence groups.
Sourcepub fn try_with_offset(&self, offset: isize) -> Result<Self>
pub fn try_with_offset(&self, offset: isize) -> Result<Self>
Adds the given offset to all columns in the expressions inside this class. This is used when schemas are appended, e.g. in joins.
Methods from Deref<Target = IndexSet<Arc<dyn PhysicalExpr>>>§
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Return the number of elements the set can hold without reallocating.
This number is a lower bound; the set might be able to hold more, but is guaranteed to be able to hold at least this many.
Computes in O(1) time.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the set contains no elements.
Computes in O(1) time.
Sourcepub fn iter(&self) -> Iter<'_, T>
pub fn iter(&self) -> Iter<'_, T>
Return an iterator over the values of the set, in their order
Sourcepub fn difference<'a, S2>(
&'a self,
other: &'a IndexSet<T, S2>,
) -> Difference<'a, T, S2>where
S2: BuildHasher,
pub fn difference<'a, S2>(
&'a self,
other: &'a IndexSet<T, S2>,
) -> Difference<'a, T, S2>where
S2: BuildHasher,
Return an iterator over the values that are in self but not other.
Values are produced in the same order that they appear in self.
Sourcepub fn symmetric_difference<'a, S2>(
&'a self,
other: &'a IndexSet<T, S2>,
) -> SymmetricDifference<'a, T, S, S2>where
S2: BuildHasher,
pub fn symmetric_difference<'a, S2>(
&'a self,
other: &'a IndexSet<T, S2>,
) -> SymmetricDifference<'a, T, S, S2>where
S2: BuildHasher,
Return an iterator over the values that are in self or other,
but not in both.
Values from self are produced in their original order, followed by
values from other in their original order.
Sourcepub fn intersection<'a, S2>(
&'a self,
other: &'a IndexSet<T, S2>,
) -> Intersection<'a, T, S2>where
S2: BuildHasher,
pub fn intersection<'a, S2>(
&'a self,
other: &'a IndexSet<T, S2>,
) -> Intersection<'a, T, S2>where
S2: BuildHasher,
Return an iterator over the values that are in both self and other.
Values are produced in the same order that they appear in self.
Sourcepub fn union<'a, S2>(&'a self, other: &'a IndexSet<T, S2>) -> Union<'a, T, S>where
S2: BuildHasher,
pub fn union<'a, S2>(&'a self, other: &'a IndexSet<T, S2>) -> Union<'a, T, S>where
S2: BuildHasher,
Return an iterator over all values that are in self or other.
Values from self are produced in their original order, followed by
values that are unique to other in their original order.
Sourcepub fn contains<Q>(&self, value: &Q) -> bool
pub fn contains<Q>(&self, value: &Q) -> bool
Return true if an equivalent to value exists in the set.
Computes in O(1) time (average).
Sourcepub fn get<Q>(&self, value: &Q) -> Option<&T>
pub fn get<Q>(&self, value: &Q) -> Option<&T>
Return a reference to the value stored in the set, if it is present,
else None.
Computes in O(1) time (average).
Sourcepub fn get_index_of<Q>(&self, value: &Q) -> Option<usize>
pub fn get_index_of<Q>(&self, value: &Q) -> Option<usize>
Return item index, if it exists in the set
Computes in O(1) time (average).
Sourcepub fn binary_search(&self, x: &T) -> Result<usize, usize>where
T: Ord,
pub fn binary_search(&self, x: &T) -> Result<usize, usize>where
T: Ord,
Search over a sorted set for a value.
Returns the position where that value is present, or the position where it can be inserted
to maintain the sort. See slice::binary_search for more details.
Computes in O(log(n)) time, which is notably less scalable than looking the value up
using get_index_of, but this can also position missing values.
Sourcepub fn binary_search_by<'a, F>(&'a self, f: F) -> Result<usize, usize>
pub fn binary_search_by<'a, F>(&'a self, f: F) -> Result<usize, usize>
Search over a sorted set with a comparator function.
Returns the position where that value is present, or the position where it can be inserted
to maintain the sort. See slice::binary_search_by for more details.
Computes in O(log(n)) time.
Sourcepub fn binary_search_by_key<'a, B, F>(
&'a self,
b: &B,
f: F,
) -> Result<usize, usize>
pub fn binary_search_by_key<'a, B, F>( &'a self, b: &B, f: F, ) -> Result<usize, usize>
Search over a sorted set with an extraction function.
Returns the position where that value is present, or the position where it can be inserted
to maintain the sort. See slice::binary_search_by_key for more details.
Computes in O(log(n)) time.
Sourcepub fn is_sorted(&self) -> boolwhere
T: PartialOrd,
pub fn is_sorted(&self) -> boolwhere
T: PartialOrd,
Checks if the values of this set are sorted.
Sourcepub fn is_sorted_by<'a, F>(&'a self, cmp: F) -> bool
pub fn is_sorted_by<'a, F>(&'a self, cmp: F) -> bool
Checks if this set is sorted using the given comparator function.
Sourcepub fn is_sorted_by_key<'a, F, K>(&'a self, sort_key: F) -> bool
pub fn is_sorted_by_key<'a, F, K>(&'a self, sort_key: F) -> bool
Checks if this set is sorted using the given sort-key function.
Sourcepub fn partition_point<P>(&self, pred: P) -> usize
pub fn partition_point<P>(&self, pred: P) -> usize
Returns the index of the partition point of a sorted set according to the given predicate (the index of the first element of the second partition).
See slice::partition_point for more details.
Computes in O(log(n)) time.
Sourcepub fn as_slice(&self) -> &Slice<T>
pub fn as_slice(&self) -> &Slice<T>
Returns a slice of all the values in the set.
Computes in O(1) time.
Sourcepub fn get_index(&self, index: usize) -> Option<&T>
pub fn get_index(&self, index: usize) -> Option<&T>
Get a value by index
Valid indices are 0 <= index < self.len().
Computes in O(1) time.
Sourcepub fn get_range<R>(&self, range: R) -> Option<&Slice<T>>where
R: RangeBounds<usize>,
pub fn get_range<R>(&self, range: R) -> Option<&Slice<T>>where
R: RangeBounds<usize>,
Returns a slice of values in the given range of indices.
Valid indices are 0 <= index < self.len().
Computes in O(1) time.
Sourcepub fn is_disjoint<S2>(&self, other: &IndexSet<T, S2>) -> boolwhere
S2: BuildHasher,
pub fn is_disjoint<S2>(&self, other: &IndexSet<T, S2>) -> boolwhere
S2: BuildHasher,
Returns true if self has no elements in common with other.
Sourcepub fn is_subset<S2>(&self, other: &IndexSet<T, S2>) -> boolwhere
S2: BuildHasher,
pub fn is_subset<S2>(&self, other: &IndexSet<T, S2>) -> boolwhere
S2: BuildHasher,
Returns true if all elements of self are contained in other.
Sourcepub fn is_superset<S2>(&self, other: &IndexSet<T, S2>) -> boolwhere
S2: BuildHasher,
pub fn is_superset<S2>(&self, other: &IndexSet<T, S2>) -> boolwhere
S2: BuildHasher,
Returns true if all elements of other are contained in self.
Trait Implementations§
Source§impl Clone for EquivalenceClass
impl Clone for EquivalenceClass
Source§fn clone(&self) -> EquivalenceClass
fn clone(&self) -> EquivalenceClass
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EquivalenceClass
impl Debug for EquivalenceClass
Source§impl Default for EquivalenceClass
impl Default for EquivalenceClass
Source§fn default() -> EquivalenceClass
fn default() -> EquivalenceClass
Source§impl Deref for EquivalenceClass
impl Deref for EquivalenceClass
Source§impl Display for EquivalenceClass
impl Display for EquivalenceClass
Source§impl From<EquivalenceClass> for Vec<Arc<dyn PhysicalExpr>>
impl From<EquivalenceClass> for Vec<Arc<dyn PhysicalExpr>>
Source§fn from(cls: EquivalenceClass) -> Self
fn from(cls: EquivalenceClass) -> Self
Source§impl IntoIterator for EquivalenceClass
impl IntoIterator for EquivalenceClass
Source§type Item = Arc<dyn PhysicalExpr>
type Item = Arc<dyn PhysicalExpr>
Source§type IntoIter = <IndexSet<<EquivalenceClass as IntoIterator>::Item> as IntoIterator>::IntoIter
type IntoIter = <IndexSet<<EquivalenceClass as IntoIterator>::Item> as IntoIterator>::IntoIter
Source§impl PartialEq for EquivalenceClass
impl PartialEq for EquivalenceClass
impl Eq for EquivalenceClass
impl StructuralPartialEq for EquivalenceClass
Auto Trait Implementations§
impl Freeze for EquivalenceClass
impl !RefUnwindSafe for EquivalenceClass
impl Send for EquivalenceClass
impl Sync for EquivalenceClass
impl Unpin for EquivalenceClass
impl !UnwindSafe for EquivalenceClass
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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