-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Use correct expression function after filter pushdown #17860
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
base: v1.3-ossivalis
Are you sure you want to change the base?
Use correct expression function after filter pushdown #17860
Conversation
Thanks for the PR! The change location makes sense - but I wonder if we can't move the result expression back instead of copying the function? It seems that that is quite limited in the scenarios it would correctly support (e.g. what if the |
Hmmm, I started working on it and am a bit stuck. Maybe we can transform the expression again via the column binding resolver? |
… same for table refs
nvm, figured it out. The physical column index is the same for all bound refs, so we can just iterate through the table filter once to find it, do the transformation & statistics propagation, then create the |
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.
Thanks! Looks good - one minor comment
@@ -0,0 +1,120 @@ | |||
WITH year_total AS |
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.
Are these intended to be added?
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.
no, must added it accidentally. will revert it
Fixes https://github.com/duckdblabs/duckdb-internal/issues/5064
We would only perform statistics propagation on a copy of the filter. Statistics propagation sets the expression function, so we need to make sure we set the expression function back on the original expression function as well.