Uh oh!
There was an error while loading. Please reload this page.
Fix propagation of optimized predicates on nested projections - #3228
Conversation
andygrove
left a comment
There was a problem hiding this comment.
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.
Dandandan
commented
Aug 27, 2022
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? |
isidentical
commented
Aug 27, 2022
@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 |
isidentical
commented
Aug 27, 2022
Definitely, will be working on that! |
Dandandan
commented
Aug 27, 2022
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 |
isidentical
commented
Aug 27, 2022
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 |
isidentical
commented
Aug 27, 2022
@Dandandan I did a re-implementation using the approach I've described below (handling this on the |
Dandandan
commented
Aug 27, 2022
Yes, this makes most sense, and simplifies the implementation quite a bit. |
codecov-commenter
commented
Aug 27, 2022
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 |
Dandandan
left a comment
There was a problem hiding this comment.
LGTM, thanks @isidentical !
Dandandan
commented
Aug 29, 2022
Thanks again @isidentical |
ursabot
commented
Aug 29, 2022
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. |
alamb
left a comment
There was a problem hiding this comment.
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