[CALCITE-7405] Pre-process expressions for correlations before building projection in SqlToRelConverter#4779
Conversation
xuzifu666
left a comment
There was a problem hiding this comment.
Need to fix CI error first.
| /.vscode/* | ||
|
|
||
| # IDEA | ||
| /out |
There was a problem hiding this comment.
When I run with intellij, git detected a ton of extra files.
6338b8f to
3784f65
Compare
…ng projection in SqlToRelConverter, simplify some gitignore paths
3784f65 to
5314e24
Compare
|
|
If we create a temporary |
Thats not an unreasonable suggestion, however I expect that change would also create a lot of test changes, both in this project and anything downstream. |
|
I prefer a simpler, more intuitive processing logic, even if it affects some of the original plans. As you mentioned, are there other places where similar issues arise, and would it be better to have a unified logic for handling them? |
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 90 days if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@calcite.apache.org list. Thank you for your contributions. |
|
I'm hoping to get more reviews on this.
Thats fine, but I imagine that solution will take significant amount of time and effort (which I do not have for this project), and my preference (as I imagine is the preference of many others) is that we solve this severe bug we know about sooner, rather than wait for a better approach to correlation in (at a minimum) SqlToRelConverter. |



To circumvent the bloat optimizations, it is necessary to provide the correlation variables (if they exist) to the builder.
The main change here is to accomplish the logic done in
SqlToRelConverter.getCorrelationswithout having built the Project node.In this way we (a) extract the correlation id to use for the RelBuilder, and (b) normalize/resolve the correlation ids and rewrite the expressions; all before invoking the RelBuilder.
I've done my best to reuse existing logic.
SqlToRelConverter.getCorrelationsandSqlToRelConverter.massageExpressionsForCorrelationrequire a lot of the same logic for resolving the correlation variables for the current scope, so that was moved to a common utility method (SqlToRelConverter.getCorrelationInfo).