-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-41350][SQL][FOLLOWUP] Allow simple name access of join hidden columns after alias #39077
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
Closed
Conversation
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
Contributor
Author
MaxGekk
approved these changes
Dec 15, 2022
viirya
approved these changes
Dec 15, 2022
Member
|
+1, LGTM. Merging to 3.3/master. |
Member
|
@cloud-fan This causes conflicts in branch-3.3. Please, open a separate PR if it is needed. |
cloud-fan
added a commit
to cloud-fan/spark
that referenced
this pull request
Dec 19, 2022
…columns after alias This is a followup of apache#38862 . apache#38862 only handles plan alias, but expression alias is missed. This PR fixes it. fix a regression Yes, certain querys that failed with `UNRESOLVED_COLUMN` before this PR can work now. new tests Closes apache#39077 from cloud-fan/bug. Authored-by: Wenchen Fan <[email protected]> Signed-off-by: Max Gekk <[email protected]>
Contributor
Author
|
3.3 PR created #39121 |
cloud-fan
added a commit
that referenced
this pull request
Dec 22, 2022
…dden columns after alias backport #39077 to 3.3 Closes #39121 from cloud-fan/backport. Authored-by: Wenchen Fan <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
cloud-fan
added a commit
that referenced
this pull request
Jan 18, 2023
### What changes were proposed in this pull request? This is a better fix than #39077 and #38862 The special attribute metadata `__qualified_access_only` is very risky, as it breaks normal column resolution. The aforementioned 2 PRs remove the restriction in `SubqueryAlias` and `Alias`, but it's not good enough as we may forget to do the same thing for new logical plans/expressions in the future. It's also problematic if advanced users manipulate logical plans and expressions directly, when there is no `SubqueryAlias` and `Alias` to remove the restriction. To be safe, we should only apply this restriction when resolving join hidden columns, which means the plan node right above `Project(Join(using or natural join))`. This PR simply removes the restriction when a column is resolved from a sequence of `Attributes`, or from star expansion, and also when adding the `Project` hidden columns to its output. This makes sure that the qualified-access-only restriction will not be leaked to normal column resolution, but only metadata column resolution. ### Why are the changes needed? To make the join hidden column feature more robust ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? existing tests Closes #39596 from cloud-fan/join. Authored-by: Wenchen Fan <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
cloud-fan
added a commit
that referenced
this pull request
Jan 18, 2023
This is a better fix than #39077 and #38862 The special attribute metadata `__qualified_access_only` is very risky, as it breaks normal column resolution. The aforementioned 2 PRs remove the restriction in `SubqueryAlias` and `Alias`, but it's not good enough as we may forget to do the same thing for new logical plans/expressions in the future. It's also problematic if advanced users manipulate logical plans and expressions directly, when there is no `SubqueryAlias` and `Alias` to remove the restriction. To be safe, we should only apply this restriction when resolving join hidden columns, which means the plan node right above `Project(Join(using or natural join))`. This PR simply removes the restriction when a column is resolved from a sequence of `Attributes`, or from star expansion, and also when adding the `Project` hidden columns to its output. This makes sure that the qualified-access-only restriction will not be leaked to normal column resolution, but only metadata column resolution. To make the join hidden column feature more robust No existing tests Closes #39596 from cloud-fan/join. Authored-by: Wenchen Fan <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
a0x8o
added a commit
to a0x8o/spark
that referenced
this pull request
Jan 18, 2023
### What changes were proposed in this pull request? This is a better fix than apache/spark#39077 and apache/spark#38862 The special attribute metadata `__qualified_access_only` is very risky, as it breaks normal column resolution. The aforementioned 2 PRs remove the restriction in `SubqueryAlias` and `Alias`, but it's not good enough as we may forget to do the same thing for new logical plans/expressions in the future. It's also problematic if advanced users manipulate logical plans and expressions directly, when there is no `SubqueryAlias` and `Alias` to remove the restriction. To be safe, we should only apply this restriction when resolving join hidden columns, which means the plan node right above `Project(Join(using or natural join))`. This PR simply removes the restriction when a column is resolved from a sequence of `Attributes`, or from star expansion, and also when adding the `Project` hidden columns to its output. This makes sure that the qualified-access-only restriction will not be leaked to normal column resolution, but only metadata column resolution. ### Why are the changes needed? To make the join hidden column feature more robust ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? existing tests Closes #39596 from cloud-fan/join. Authored-by: Wenchen Fan <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
a0x8o
added a commit
to a0x8o/spark
that referenced
this pull request
Jan 18, 2023
### What changes were proposed in this pull request? This is a better fix than apache/spark#39077 and apache/spark#38862 The special attribute metadata `__qualified_access_only` is very risky, as it breaks normal column resolution. The aforementioned 2 PRs remove the restriction in `SubqueryAlias` and `Alias`, but it's not good enough as we may forget to do the same thing for new logical plans/expressions in the future. It's also problematic if advanced users manipulate logical plans and expressions directly, when there is no `SubqueryAlias` and `Alias` to remove the restriction. To be safe, we should only apply this restriction when resolving join hidden columns, which means the plan node right above `Project(Join(using or natural join))`. This PR simply removes the restriction when a column is resolved from a sequence of `Attributes`, or from star expansion, and also when adding the `Project` hidden columns to its output. This makes sure that the qualified-access-only restriction will not be leaked to normal column resolution, but only metadata column resolution. ### Why are the changes needed? To make the join hidden column feature more robust ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? existing tests Closes #39596 from cloud-fan/join. Authored-by: Wenchen Fan <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
a0x8o
added a commit
to a0x8o/spark
that referenced
this pull request
Jan 18, 2023
### What changes were proposed in this pull request? This is a better fix than apache/spark#39077 and apache/spark#38862 The special attribute metadata `__qualified_access_only` is very risky, as it breaks normal column resolution. The aforementioned 2 PRs remove the restriction in `SubqueryAlias` and `Alias`, but it's not good enough as we may forget to do the same thing for new logical plans/expressions in the future. It's also problematic if advanced users manipulate logical plans and expressions directly, when there is no `SubqueryAlias` and `Alias` to remove the restriction. To be safe, we should only apply this restriction when resolving join hidden columns, which means the plan node right above `Project(Join(using or natural join))`. This PR simply removes the restriction when a column is resolved from a sequence of `Attributes`, or from star expansion, and also when adding the `Project` hidden columns to its output. This makes sure that the qualified-access-only restriction will not be leaked to normal column resolution, but only metadata column resolution. ### Why are the changes needed? To make the join hidden column feature more robust ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? existing tests Closes #39596 from cloud-fan/join. Authored-by: Wenchen Fan <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
a0x8o
added a commit
to a0x8o/spark
that referenced
this pull request
Jul 29, 2024
### What changes were proposed in this pull request? This is a better fix than apache/spark#39077 and apache/spark#38862 The special attribute metadata `__qualified_access_only` is very risky, as it breaks normal column resolution. The aforementioned 2 PRs remove the restriction in `SubqueryAlias` and `Alias`, but it's not good enough as we may forget to do the same thing for new logical plans/expressions in the future. It's also problematic if advanced users manipulate logical plans and expressions directly, when there is no `SubqueryAlias` and `Alias` to remove the restriction. To be safe, we should only apply this restriction when resolving join hidden columns, which means the plan node right above `Project(Join(using or natural join))`. This PR simply removes the restriction when a column is resolved from a sequence of `Attributes`, or from star expansion, and also when adding the `Project` hidden columns to its output. This makes sure that the qualified-access-only restriction will not be leaked to normal column resolution, but only metadata column resolution. ### Why are the changes needed? To make the join hidden column feature more robust ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? existing tests Closes #39596 from cloud-fan/join. Authored-by: Wenchen Fan <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
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.
What changes were proposed in this pull request?
This is a followup of #38862 . #38862 only handles plan alias, but expression alias is missed. This PR fixes it.
Why are the changes needed?
fix a regression
Does this PR introduce any user-facing change?
Yes, certain querys that failed with
UNRESOLVED_COLUMNbefore this PR can work now.How was this patch tested?
new tests