Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Jan 7, 2025
1 parent da9bc9c commit c2f4fbe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
13 changes: 3 additions & 10 deletions datafusion/physical-expr/src/equivalence/ordering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,9 @@ impl OrderingEquivalenceClass {
/// Returns the concatenation of all the orderings. This enables merge
/// operations to preserve all equivalent orderings simultaneously.
pub fn output_ordering(&self) -> Option<LexOrdering> {
let output_ordering = self.orderings.iter().flatten().cloned().collect();
let output_ordering = collapse_lex_ordering(output_ordering);
let output_ordering: LexOrdering =
self.orderings.iter().flatten().cloned().collect();
let output_ordering = output_ordering.collapse();
(!output_ordering.is_empty()).then_some(output_ordering)
}

Expand Down Expand Up @@ -207,14 +208,6 @@ impl IntoIterator for OrderingEquivalenceClass {
}
}

/// This function constructs a duplicate-free `LexOrdering` by filtering out
/// duplicate entries that have same physical expression inside. For example,
/// `vec![a ASC, a DESC]` collapses to `vec![a ASC]`.
#[deprecated(since = "45.0.0", note = "use LexOrdering::collapse")]
pub fn collapse_lex_ordering(input: LexOrdering) -> LexOrdering {
input.collapse()
}

/// Trims `orderings[idx]` if some suffix of it overlaps with a prefix of
/// `orderings[pre_idx]`. Returns `true` if there is any overlap, `false` otherwise.
fn resolve_overlap(orderings: &mut [LexOrdering], idx: usize, pre_idx: usize) -> bool {
Expand Down
3 changes: 1 addition & 2 deletions datafusion/physical-expr/src/equivalence/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use std::slice::Iter;
use std::sync::Arc;
use std::{fmt, mem};

use super::ordering::collapse_lex_ordering;
use crate::equivalence::class::{const_exprs_contains, AcrossPartitions};
use crate::equivalence::{
collapse_lex_req, EquivalenceClass, EquivalenceGroup, OrderingEquivalenceClass,
Expand Down Expand Up @@ -911,7 +910,7 @@ impl EquivalenceProperties {
// Simplify each ordering by removing redundant sections:
orderings
.chain(projected_orderings)
.map(collapse_lex_ordering)
.map(|lex_ordering| lex_ordering.collapse())
.collect()
}

Expand Down

0 comments on commit c2f4fbe

Please sign in to comment.