alamb commented on code in PR #13612:
URL: https://github.com/apache/datafusion/pull/13612#discussion_r1866406654
##########
datafusion/physical-expr/src/equivalence/class.rs:
##########
@@ -190,47 +189,47 @@ pub struct EquivalenceClass {
/// The expressions in this equivalence class. The order doesn't
/// matter for equivalence purposes
///
- /// TODO: use a HashSet for this instead of a Vec
- exprs: Vec<Arc<dyn PhysicalExpr>>,
+ exprs: IndexSet<Arc<dyn PhysicalExpr>>,
}
impl PartialEq for EquivalenceClass {
/// Returns true if other is equal in the sense
/// of bags (multi-sets), disregarding their orderings.
fn eq(&self, other: &Self) -> bool {
- physical_exprs_bag_equal(&self.exprs, &other.exprs)
+ self.exprs.eq(&other.exprs)
}
}
impl EquivalenceClass {
/// Create a new empty equivalence class
pub fn new_empty() -> Self {
- Self { exprs: vec![] }
+ Self {
+ exprs: IndexSet::new(),
+ }
}
// Create a new equivalence class from a pre-existing `Vec`
- pub fn new(mut exprs: Vec<Arc<dyn PhysicalExpr>>) -> Self {
- deduplicate_physical_exprs(&mut exprs);
- Self { exprs }
+ pub fn new(exprs: Vec<Arc<dyn PhysicalExpr>>) -> Self {
+ Self {
+ exprs: exprs.into_iter().collect(),
Review Comment:
nice!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]