Skip to content

Commit

Permalink
Minor: Document ExecutionPlan::equivalence_properties more thorough…
Browse files Browse the repository at this point in the history
…ly (apache#8128)

* Minor: Document ExecutionPlan::equivalence_properties more thoroughly

* Apply suggestions from code review

Co-authored-by: Liang-Chi Hsieh <[email protected]>
Co-authored-by: Mustafa Akur <[email protected]>

---------

Co-authored-by: Liang-Chi Hsieh <[email protected]>
Co-authored-by: Mustafa Akur <[email protected]>
  • Loading branch information
3 people authored Nov 13, 2023
1 parent cbb2fd7 commit 4fb4b21
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion datafusion/physical-plan/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,23 @@ pub trait ExecutionPlan: Debug + DisplayAs + Send + Sync {
.collect()
}

/// Get the [`EquivalenceProperties`] within the plan
/// Get the [`EquivalenceProperties`] within the plan.
///
/// Equivalence properties tell DataFusion what columns are known to be
/// equal, during various optimization passes. By default, this returns "no
/// known equivalences" which is always correct, but may cause DataFusion to
/// unnecessarily resort data.
///
/// If this ExecutionPlan makes no changes to the schema of the rows flowing
/// through it or how columns within each row relate to each other, it
/// should return the equivalence properties of its input. For
/// example, since `FilterExec` may remove rows from its input, but does not
/// otherwise modify them, it preserves its input equivalence properties.
/// However, since `ProjectionExec` may calculate derived expressions, it
/// needs special handling.
///
/// See also [`Self::maintains_input_order`] and [`Self::output_ordering`]
/// for related concepts.
fn equivalence_properties(&self) -> EquivalenceProperties {
EquivalenceProperties::new(self.schema())
}
Expand Down

0 comments on commit 4fb4b21

Please sign in to comment.