[CALCITE-4366] LatticeSuggester should treat UNION and VALUES sub-expressions as tables#2248
Draft
julianhyde wants to merge 5 commits into
Draft
[CALCITE-4366] LatticeSuggester should treat UNION and VALUES sub-expressions as tables#2248julianhyde wants to merge 5 commits into
julianhyde wants to merge 5 commits into
Conversation
…er.convertFrom Add RelBuilder.applyIf
…ressions as tables We achieve this by adding a wrapper table function in the RelNode tree above any UNION or VALUES after sql-to-rel but before calling LatticeSuggester. If the UNION or VALUES expression is a common-table expression (i.e. in the WITH clause), use the name of the WITH clause table and columns for the dummy table. That allows use to generate a nicer model later. Add SqlToRelConverter.Config.postStep(), to apply a user-specified transform to a RelNode after sql-to-rel conversion. (We could make decorrelation use this hook.) Implement getCursorOperand(int) in RexCallBinding, so that when you call RelBuilder.tableFunctionScan the row-type can be deduced in terms of the relational input(s). Refactor LatticeSuggesterTest to make it easier to write tests with custom config.
Contributor
|
@julianhyde , Could you please refrain from adding It would be nice if you could annotate |
jswett77
reviewed
Nov 30, 2020
| return new BaseColRef(tableRef, offset); | ||
| } | ||
| }; | ||
| } else if (r instanceof TableFunctionScan) { |
Contributor
There was a problem hiding this comment.
I missed that this is checking for TableFunctionScan and that my wrapper extended TableScan. Should I rework my wrapper to be a TFS or should this be checking for TableScan?
Contributor
Author
There was a problem hiding this comment.
Ideally, you would throw away your code and move the logic into LatticeSuggester.
But failing that, use a TableFunctionScan that calls the WRAP function. Calls to any other table function will not be treated as wrappers.
julianhyde
force-pushed
the
main
branch
2 times, most recently
from
June 8, 2023 21:21
8a5cf83 to
cf7f71b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.