-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
equivalence classes: use normalized mapping for projection #14327
base: main
Are you sure you want to change the base?
Conversation
2f76a6a
to
453fb30
Compare
Thank you @askalt. I'll review this in detail. One initial suggestion: instead of adding a unit test and introducing additional testing components, I believe the same logic can be reproduced in an .slt test. You can assert the intended plan more effectively. |
453fb30
to
a777890
Compare
Thank you! |
I am guessing what is meant was writing an SLT test whose output plan would change if this logic/fix weren't there. Maybe an optimization that wouldn't take place because of the normalization is not done properly. |
a777890
to
13265a1
Compare
This patch fixes the logic that projects equivalence classes: when run over the projection mapping to find new equivalent expressions, we need to normalize a source expression.
13265a1
to
ff1c139
Compare
I added a test to .slt. It was slightly tricky because setting up a table with existing equivalence classes (e.g., a being an alias for b) is not very straightforward. I took advantage of the fact that the projection [x, y] with the filter x == y generates a new equivalence class. Additionally, I left a small unit test in class.rs. It doesn’t introduce new logic with some |
Which issue does this PR close?
Closes #14326.
Rationale for this change
See the issue above.
What changes are included in this PR?
Now projection mapping source expression is normalized before we lookup in the map.
Are these changes tested?
Yes, there is a unit test.
Are there any user-facing changes?
No