Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Eq trait for Expr and nested types #3381

Merged
merged 1 commit into from
Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions datafusion/expr/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ use std::sync::Arc;
/// assert_eq!(op, Operator::Eq);
/// }
/// ```
#[derive(Clone, PartialEq, Hash)]
#[derive(Clone, PartialEq, Eq, Hash)]
pub enum Expr {
/// An expression with a specific name.
Alias(Box<Expr>, String),
Expand Down Expand Up @@ -293,7 +293,7 @@ pub enum Expr {
/// for Postgres definition.
/// See https://spark.apache.org/docs/latest/sql-ref-syntax-qry-select-groupby.html
/// for Apache Spark definition.
#[derive(Clone, PartialEq, Hash)]
#[derive(Clone, PartialEq, Eq, Hash)]
pub enum GroupingSet {
/// Rollup grouping sets
Rollup(Vec<Expr>),
Expand Down
2 changes: 2 additions & 0 deletions datafusion/expr/src/logical_plan/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1430,6 +1430,8 @@ impl PartialEq for Subquery {
}
}

impl Eq for Subquery {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well I suppose Eq is satisfied given that PartialEq always returns false the requirements

https://doc.rust-lang.org/std/cmp/trait.Eq.html

are satisfied in a strange sort of way


/// Logical partitioning schemes supported by the repartition operator.
#[derive(Debug, Clone)]
pub enum Partitioning {
Expand Down
2 changes: 2 additions & 0 deletions datafusion/expr/src/udaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ impl PartialEq for AggregateUDF {
}
}

impl Eq for AggregateUDF {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


impl std::hash::Hash for AggregateUDF {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.name.hash(state);
Expand Down
2 changes: 2 additions & 0 deletions datafusion/expr/src/udf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ impl PartialEq for ScalarUDF {
}
}

impl Eq for ScalarUDF {}

impl std::hash::Hash for ScalarUDF {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.name.hash(state);
Expand Down