ARROW-12048: [Rust][DataFusion] Support Common Table Expressions#9776
Closed
Dandandan wants to merge 10 commits intoapache:masterfrom
Closed
ARROW-12048: [Rust][DataFusion] Support Common Table Expressions#9776Dandandan wants to merge 10 commits intoapache:masterfrom
Dandandan wants to merge 10 commits intoapache:masterfrom
Conversation
Dandandan
commented
Mar 23, 2021
…rence, add more tests
jorgecarleitao
approved these changes
Mar 23, 2021
Member
jorgecarleitao
left a comment
There was a problem hiding this comment.
LGTM. Thanks @Dandandan !
Contributor
|
Thank you for this @Dandandan ! I plan to review this carefully tomorrow |
returnString
approved these changes
Mar 23, 2021
Dandandan
commented
Mar 24, 2021
| let logical_plan = self.query_to_plan_with_alias( | ||
| &cte.query, | ||
| Some(cte.alias.name.value.clone()), | ||
| &mut ctes.clone(), |
Contributor
Author
There was a problem hiding this comment.
This clone is now relatively inefficient for very long and/or deep ctes.
Solutions I see for this problem.
- use an immutable HashMap (O(1) clone, easier to program), example: https://docs.rs/im/15.0.0/im/struct.HashMap.html
- use something like "frames", e.g.
Vec<HashMap<String, LogicalPlan>>-> when looking up a reference first look up level 0, level-1, level -2, etc. - cleanup the variables before returning (removing / replacing the added references)
Contributor
There was a problem hiding this comment.
I think the frames idea makes the most sense to me -- namely a stack
We can handle it in the future if/when it shows itself to be a problem
alamb
approved these changes
Mar 24, 2021
| let logical_plan = self.query_to_plan_with_alias( | ||
| &cte.query, | ||
| Some(cte.alias.name.value.clone()), | ||
| &mut ctes.clone(), |
Contributor
There was a problem hiding this comment.
I think the frames idea makes the most sense to me -- namely a stack
We can handle it in the future if/when it shows itself to be a problem
alamb
added a commit
that referenced
this pull request
Mar 28, 2021
… of SQL features @Dandandan added the feature in #9776, updating docs to keep pace Closes #9795 from alamb/alamb/CTE Authored-by: Andrew Lamb <[email protected]> Signed-off-by: Andrew Lamb <[email protected]>
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.
This adds support for CTE syntax:
Before this PR, the CTE syntax was ignored.
This PR supports CTEs referening a previous CTE within the same query (but no forward references)