-
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
Fix propagation of optimized predicates on nested projections #3228
Conversation
807b429
to
b14abb7
Compare
b14abb7
to
5994ab8
Compare
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.
The changes look reasonable to me, but I am not very familiar with some of this code so will need to look closer. I will make time in the next day or two.
I'm not sure if this fixes the bug in issue #3073? I'm not totally convinced we should not propagate filters without column (e.g. constants), the result should remain the same whether it is propagated or not. Issue #3073 seems to be about a filter expression with a column, that somehow doesn't filter the row out. Could we add a test for #3073 here? |
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.
Add test for #3037 and explain why changes are needed
@Dandandan since the example in #3073 uses an in-memory table, the filter
There is already a similar work done by an earlier step of the filter pushdown optimizer which ensures that |
Definitely, will be working on that! |
0ea8286
to
8a72720
Compare
Isn't the issue then that the propagated filters without column are not added to the plan at all, even when we are at the bottom of a plan? E.g. a propagated |
Exactly, at least that is my understanding of this issue. I thought as is, it would be similar to the existing behaviour from #225 but this time done on the projection level rather than filter level. If it makes sense, I can also change the logic in |
8a72720
to
39c6459
Compare
@Dandandan I did a re-implementation using the approach I've described below (handling this on the |
Yes, this makes most sense, and simplifies the implementation quite a bit. |
Codecov Report
@@ Coverage Diff @@
## master #3228 +/- ##
==========================================
+ Coverage 85.91% 85.93% +0.01%
==========================================
Files 294 294
Lines 53443 53469 +26
==========================================
+ Hits 45918 45946 +28
+ Misses 7525 7523 -2
📣 We’re building smart automated test selection to slash your CI/CD build times. 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, thanks @isidentical !
Thanks again @isidentical |
Benchmark runs are scheduled for baseline = 873b071 and contender = 7aed4d6. 7aed4d6 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
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.
This looks like a great change -- I think it is a very positive sign when we fix bugs by deleting code 👍
Thanks @isidentical and @Dandandan
Which issue does this PR close?
Closes #3073.
Rationale for this change
This PR prevents the removal of predicates without referencing columns (
WHERE FALSE
,WHERE 1=1
, etc.) that might have been created during the column name replacing phase (on filter pushdown optimizer when dealing with projections specifically).What changes are included in this PR?
Columnless predicates are now collected into a separate entity, stripped away from the actual list of filters when switching the projection/filter and then re-applied.
Are there any user-facing changes?
This should fix the bug referenced in #3073