Skip to content

Commit f5f950c

Browse files
alambviirya
authored andcommitted
Minor: add doc comments to ExtractEquijoinPredicate (apache#7658)
* Minor: add doc comments to `ExtractEquijoinPredicate` * Update datafusion/optimizer/src/extract_equijoin_predicate.rs Co-authored-by: Liang-Chi Hsieh <viirya@gmail.com> --------- Co-authored-by: Liang-Chi Hsieh <viirya@gmail.com>
1 parent d370f5e commit f5f950c

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

datafusion/optimizer/src/extract_equijoin_predicate.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
//! Optimizer rule to extract equijoin expr from filter
18+
//! [`ExtractEquijoinPredicate`] rule that extracts equijoin predicates
1919
use crate::optimizer::ApplyOrder;
2020
use crate::utils::split_conjunction;
2121
use crate::{OptimizerConfig, OptimizerRule};
@@ -28,7 +28,17 @@ use std::sync::Arc;
2828
// equijoin predicate
2929
type EquijoinPredicate = (Expr, Expr);
3030

31-
/// Optimization rule that extract equijoin expr from the filter
31+
/// Optimizer that splits conjunctive join predicates into equijoin
32+
/// predicates and (other) filter predicates.
33+
///
34+
/// Join algorithms are often highly optimized for equality predicates such as `x = y`,
35+
/// often called `equijoin` predicates, so it is important to locate such predicates
36+
/// and treat them specially.
37+
///
38+
/// For example, `SELECT ... FROM A JOIN B ON (A.x = B.y AND B.z > 50)`
39+
/// has one equijoin predicate (`A.x = B.y`) and one filter predicate (`B.z > 50`).
40+
/// See [find_valid_equijoin_key_pair] for more information on what predicates
41+
/// are considered equijoins.
3242
#[derive(Default)]
3343
pub struct ExtractEquijoinPredicate;
3444

0 commit comments

Comments
 (0)