Skip to content

Commit

Permalink
Minor: Document ExecutionPlan::equivalence_properties more thoroughly
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Nov 10, 2023
1 parent 91c9d6f commit 3fb9842
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 DataFsion what columns are known to be
/// equal, during various optimization passes. By default, this returns " no
/// known equivalances" which is always correct, but may cause DataFusion to
/// unecessairly resort data.
///
/// If this ExecutionPlan makes no changes to the schema of the rows flowing
/// through it or how columns withink each row relate to each other, it
/// should 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 equivalece 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 3fb9842

Please sign in to comment.