-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
sql: Reuse existing selectNode renders transparently #9173
Comments
After looking into how the
@knz you touched a lot of this |
Using the string representation of the expression would be a horrible, horrible hack but yes I believe it would work. |
The expressions should be simplified+normalized first though. lest "(a)" and "((a))" not compare equal. |
What if there are functions in the expression? (e.g. |
AFAIK SQL does not mandate that non-deterministic functions return different values if they occur in different places in the same expression for the same output row. Consequently we can't expect that they return different values in different expressions. |
Although if we really want to be conservative we could have a function attribute to mark non determinism and avoid merging renders if they are not deterministic. (But I don't think that's necessary) |
Don't we already have that attribute: impure? |
I think we're confused in the code about the meaning For example all the aggregate functions are marked "impure" for this reason. I am still of the opinion that it doesn't matter whether there are special functions or not for the purpose of deciding to merge renders. But if we want to tag them the |
This issue has been partly fixed by #10799: the sortNode now properly reuses renders based on string comparison after normalization of names (to IndexedVars). The limitations are:
|
@knz I'm not up-to-date on the current state of this issue. Do you mind updating it or closing it if everything has been addressed? |
The main situation that motivated this issue is addressed. Corner cases can be dealt with as optimizations later. |
SQL's
sortNode
does a lot of work to reuse existingselectNode
renders when possible when it needs to add renders. Due to the introduction ofwindowNode
, this functionality is now needed in multiple locations. We should pull out this logic so that it can be reused.The text was updated successfully, but these errors were encountered: