Skip to content

Commit

Permalink
Cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
gokselk committed Dec 13, 2024
1 parent 2e25277 commit 48ef66a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
11 changes: 9 additions & 2 deletions datafusion/physical-expr/src/equivalence/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,15 @@ impl EquivalenceGroup {
}

/// Checks if two expressions are equal either directly or through equivalence classes.
pub fn exprs_equal(&self, left: &Arc<dyn PhysicalExpr>, right: &Arc<dyn PhysicalExpr>) -> bool {
left.eq(right) || self.iter().any(|cls| cls.contains(left) && cls.contains(right))
pub fn exprs_equal(
&self,
left: &Arc<dyn PhysicalExpr>,
right: &Arc<dyn PhysicalExpr>,
) -> bool {
left.eq(right)
|| self
.iter()
.any(|cls| cls.contains(left) && cls.contains(right))
}
}

Expand Down
6 changes: 3 additions & 3 deletions datafusion/physical-expr/src/equivalence/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ impl EquivalenceProperties {
sort_exprs
.into_iter()
.filter(|expr| !self.is_expr_constant(&expr.expr))
.collect()
.collect(),
);

if filtered_exprs.is_empty() {
Expand Down Expand Up @@ -430,8 +430,8 @@ impl EquivalenceProperties {

// Check if new order matches existing prefix (considering equivalences)
new_order.iter().zip(existing).all(|(new, existing)| {
self.eq_group.exprs_equal(&new.expr, &existing.expr) &&
new.options == existing.options
self.eq_group.exprs_equal(&new.expr, &existing.expr)
&& new.options == existing.options
})
}

Expand Down

0 comments on commit 48ef66a

Please sign in to comment.