-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add hash support for PhysicalExpr and PhysicalSortExpr #6625
Conversation
# Conflicts: # datafusion/core/src/physical_plan/windows/mod.rs # datafusion/physical-expr/src/equivalence.rs
# Conflicts: # datafusion/physical-expr/src/equivalence.rs
# Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
# Conflicts: # datafusion/physical-expr/src/equivalence.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @mustafasrepo -- this looks really neat. I think it would be best if we could remove the panic's (via unimplemented
) if possible
@@ -39,7 +40,7 @@ pub struct EquivalenceProperties<T = Column> { | |||
schema: SchemaRef, | |||
} | |||
|
|||
impl<T: PartialEq + Clone> EquivalenceProperties<T> { | |||
impl<T: Eq + Clone + Hash> EquivalenceProperties<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM -- thank you @mustafasrepo. This is a nice change I think
Which issue does this PR close?
Closes #.
Rationale for this change
In the discussion @alamb suggested to implement
dyn_hash
method so that we can add support for hashing to traits. In this PR by using his suggestions we added support for hashing toPhysicalExpr
andPhysicalSortExpr
. This enables us to useHashSet
insideEquivalentClass
. Hence logic is simplified a bit inEquivalentClass
andEquivalenceProperties
implementation.What changes are included in this PR?
Are these changes tested?
This is a refactor, existing tests should be sufficient.
Are there any user-facing changes?
We add
fn dyn_hash(&self, _state: &mut dyn Hasher);
method to thePhysicalExpr
trait.