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.
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
[SPARK-50838][SQL]Performs additional checks inside recursive CTEs to throw an error if forbidden case is encountered #49518
[SPARK-50838][SQL]Performs additional checks inside recursive CTEs to throw an error if forbidden case is encountered #49518
Changes from 25 commits
7f71cdc
23f65d5
9f4a84a
05cb795
c455756
f46823b
8f3cfa8
5d70004
c6dbae5
b9ebdff
0da1043
0a885a6
ec8c8c3
b7af544
d4af85a
3f11993
ffa8aa2
879df0a
d073e0a
43a7460
45fdff9
7c08882
6f99924
a1ce987
07046d9
38fa2ef
1ab39aa
99fafaf
0c1c107
48b21cb
236f202
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
nit: let's match
CTERelationDef
here and callcheckForSelfReferenceInSubquery
. The function should use the cte id to find recursive references in subquery expressions.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.
But there we come to the problem that we discussed.
Union
won't be substituted toUnionLoop
in case we have a self-reference in subquery.Should I just leave it in
ResolveWithCTE
? Because anyway, the part ofResolveWithCTE
I placed it will always be executed at most once.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.
nit: let's not use
.foreach
here which causes O(n^2) time complexity. When matching certain nodes we will callunionLoopRefNotAllowedUnderCurrentNode
which also traverse the tree.how about this:
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.
Makes completely sense. It should be fixed now. Thanks a lot