-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-11863][SQL] Unable to resolve order by if it contains mixture of aliases and real columns #9961
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
…xture of aliases and real columns.
|
Test build #46670 has finished for PR 9961 at commit
|
Contributor
Author
Contributor
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.
indent
|
Test build #46723 has finished for PR 9961 at commit
|
Contributor
|
Thanks, I'm going to merge this to master and 1.6. |
asfgit
pushed a commit
that referenced
this pull request
Nov 26, 2015
…of aliases and real columns this is based on #9844, with some bug fix and clean up. The problems is that, normal operator should be resolved based on its child, but `Sort` operator can also be resolved based on its grandchild. So we have 3 rules that can resolve `Sort`: `ResolveReferences`, `ResolveSortReferences`(if grandchild is `Project`) and `ResolveAggregateFunctions`(if grandchild is `Aggregate`). For example, `select c1 as a , c2 as b from tab group by c1, c2 order by a, c2`, we need to resolve `a` and `c2` for `Sort`. Firstly `a` will be resolved in `ResolveReferences` based on its child, and when we reach `ResolveAggregateFunctions`, we will try to resolve both `a` and `c2` based on its grandchild, but failed because `a` is not a legal aggregate expression. whoever merge this PR, please give the credit to dilipbiswal Author: Dilip Biswal <[email protected]> Author: Wenchen Fan <[email protected]> Closes #9961 from cloud-fan/sort. (cherry picked from commit bc16a67) Signed-off-by: Michael Armbrust <[email protected]>
Contributor
|
@marmbrus @cloud-fan Thank you !! |
markhamstra
pushed a commit
to markhamstra/spark
that referenced
this pull request
Dec 9, 2015
…of aliases and real columns this is based on apache#9844, with some bug fix and clean up. The problems is that, normal operator should be resolved based on its child, but `Sort` operator can also be resolved based on its grandchild. So we have 3 rules that can resolve `Sort`: `ResolveReferences`, `ResolveSortReferences`(if grandchild is `Project`) and `ResolveAggregateFunctions`(if grandchild is `Aggregate`). For example, `select c1 as a , c2 as b from tab group by c1, c2 order by a, c2`, we need to resolve `a` and `c2` for `Sort`. Firstly `a` will be resolved in `ResolveReferences` based on its child, and when we reach `ResolveAggregateFunctions`, we will try to resolve both `a` and `c2` based on its grandchild, but failed because `a` is not a legal aggregate expression. whoever merge this PR, please give the credit to dilipbiswal Author: Dilip Biswal <[email protected]> Author: Wenchen Fan <[email protected]> Closes apache#9961 from cloud-fan/sort.
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 is based on #9844, with some bug fix and clean up.
The problems is that, normal operator should be resolved based on its child, but
Sortoperator can also be resolved based on its grandchild. So we have 3 rules that can resolveSort:ResolveReferences,ResolveSortReferences(if grandchild isProject) andResolveAggregateFunctions(if grandchild isAggregate).For example,
select c1 as a , c2 as b from tab group by c1, c2 order by a, c2, we need to resolveaandc2forSort. Firstlyawill be resolved inResolveReferencesbased on its child, and when we reachResolveAggregateFunctions, we will try to resolve bothaandc2based on its grandchild, but failed becauseais not a legal aggregate expression.whoever merge this PR, please give the credit to @dilipbiswal