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

optimizer: hoist type knowledge into transform::normalize_lets #17769

Merged
merged 1 commit into from
Feb 22, 2023

Conversation

sploiselle
Copy link
Contributor

Our type system has an unexpected corner in that the Eq implementation is derived but has no type knowledge, which necessitates using something other than == when determining type interoperability, i.e. a function named base_eq.

This patch fixes an instance of this in the optimizer, but probably warrants a more thorough investigation into where else it's used.

Motivation

This PR fixes a recognized bug. Fixes MaterializeInc/database-issues#5174

Checklist

  • This PR has adequate test coverage / QA involvement has been duly considered.
  • This PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way) and therefore is tagged with a T-proto label.
  • If this PR will require changes to cloud orchestration, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label (example).
  • This PR includes the following user-facing behavior changes:

Our type system has an unexpected corner in that the Eq
implementation is derived but has no type knowledge, which
necessitates using something other than `==` when determining
type interoperability, i.e. a function named `base_eq`.

This patch fixes an instance of this in the optimizer, but probably
warrants a more thorough investigation into where else it's used.
@sploiselle sploiselle requested review from def- and a team February 21, 2023 18:05
@aalexandrov
Copy link
Contributor

aalexandrov commented Feb 22, 2023

@sploiselle I've tried adding the derived eq to the list of disallowed-methods in clippy.yoml, sadly without cargo clippy complaining about the == comparison that you are fixing. It seems that we have to wait until rust-lang/rust-clippy#8581 before we can merge this.

disallowed-methods = [
    # ...
    { path = "mz_repr::ScalarType::eq", reason = "use `ScalarType::base_eq` instead" },
]

@sploiselle sploiselle merged commit db510ab into MaterializeInc:main Feb 22, 2023
@sploiselle sploiselle deleted the optimizer-lets-eq branch February 22, 2023 15:47
@frankmcsherry
Copy link
Contributor

Thanks @sploiselle!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants