Skip to content

Add hash support for PhysicalExpr and PhysicalSortExpr#6625

Merged
alamb merged 17 commits into
apache:mainfrom
synnada-ai:feature/remove_ordered_column
Jun 13, 2023
Merged

Add hash support for PhysicalExpr and PhysicalSortExpr#6625
alamb merged 17 commits into
apache:mainfrom
synnada-ai:feature/remove_ordered_column

Conversation

@mustafasrepo

@mustafasrepo mustafasrepo commented Jun 10, 2023

Copy link
Copy Markdown
Contributor

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 to PhysicalExpr and PhysicalSortExpr . This enables us to use HashSet inside EquivalentClass . Hence logic is simplified a bit in EquivalentClass and EquivalenceProperties 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 the PhysicalExpr trait.

mustafasrepo and others added 16 commits May 26, 2023 14:24
# 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

@alamb alamb left a comment

Copy link
Copy Markdown
Contributor

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

}

impl<T: PartialEq + Clone> EquivalenceProperties<T> {
impl<T: Eq + Clone + Hash> EquivalenceProperties<T> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

❤️

Comment thread datafusion/physical-expr/src/expressions/cast.rs Outdated
Comment thread datafusion/physical-expr/src/expressions/cast.rs Outdated
Comment thread datafusion/physical-expr/src/expressions/in_list.rs Outdated
Comment thread datafusion/physical-expr/src/scalar_function.rs Outdated
Comment thread datafusion/physical-expr/src/physical_expr.rs

@alamb alamb left a comment

Copy link
Copy Markdown
Contributor

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

@alamb alamb merged commit 065dba7 into apache:main Jun 13, 2023
@mustafasrepo mustafasrepo deleted the feature/remove_ordered_column branch June 13, 2023 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

physical-expr Changes to the physical-expr crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants