You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by al...@apache.org on 2023/05/26 17:21:42 UTC

[arrow-datafusion] branch main updated: Minor add some more docs to equivalence class code (#6461)

This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new 784ec5f322 Minor add some more docs to equivalence class code (#6461)
784ec5f322 is described below

commit 784ec5f322a9edb8b880cfb1b7ccf6806c2f8165
Author: Andrew Lamb <an...@nerdnetworks.org>
AuthorDate: Fri May 26 13:21:36 2023 -0400

    Minor add some more docs to equivalence class code (#6461)
---
 datafusion/physical-expr/src/equivalence.rs | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/datafusion/physical-expr/src/equivalence.rs b/datafusion/physical-expr/src/equivalence.rs
index a1f2df9208..c3a55437dd 100644
--- a/datafusion/physical-expr/src/equivalence.rs
+++ b/datafusion/physical-expr/src/equivalence.rs
@@ -25,7 +25,13 @@ use std::collections::{HashMap, HashSet};
 use std::hash::Hash;
 use std::sync::Arc;
 
-/// Equivalence Properties is a vec of EquivalentClass.
+/// Represents a collection of [`EquivalentClass`] (equivalences
+/// between columns in relations)
+///
+/// This is used to represent both:
+///
+/// 1. Equality conditions (like `A=B`), when `T` = [`Column`]
+/// 2. Ordering (like `A ASC = B ASC`), when `T` = [`OrderedColumn`]
 #[derive(Debug, Clone)]
 pub struct EquivalenceProperties<T = Column> {
     classes: Vec<EquivalentClass<T>>,
@@ -40,6 +46,7 @@ impl<T: Eq + Hash + Clone> EquivalenceProperties<T> {
         }
     }
 
+    /// return the set of equivalences
     pub fn classes(&self) -> &[EquivalentClass<T>] {
         &self.classes
     }
@@ -48,6 +55,7 @@ impl<T: Eq + Hash + Clone> EquivalenceProperties<T> {
         self.schema.clone()
     }
 
+    /// Add the [`EquivalentClass`] from `iter` to this list
     pub fn extend<I: IntoIterator<Item = EquivalentClass<T>>>(&mut self, iter: I) {
         for ec in iter {
             self.classes.push(ec)
@@ -187,7 +195,9 @@ impl<T: Eq + Hash + Clone> EquivalentClass<T> {
     }
 }
 
-/// This object represents a [`Column`] with a definite ordering.
+/// This object represents a [`Column`] with a definite ordering, for
+/// example `A ASC` and is used to represent equivalent orderings in
+/// the optimizer.
 #[derive(Debug, Hash, PartialEq, Eq, Clone)]
 pub struct OrderedColumn {
     pub col: Column,