-
Notifications
You must be signed in to change notification settings - Fork 28.2k
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-7659] [SQL] Sort by attributes that are not present in the select clause when there is windowexpression analyze error #6169
Conversation
Test build #32768 has finished for PR 6169 at commit
|
I've tested the following query in Hive
It also failed in semantic analysis, I am not sure why you think we should support this? As the Sorry if misunderstood something. |
@chenghao-intel We are little bit different on handling order by columns. For Hive, order by columns need to appear in the select clause. We do not have this restriction. In the analyzer, we will find the missing columns and add it back to the project list. |
@chenghao-intel in the old version we support sort by attribute which not in child output, that is what
and
this two sql is valid in many sql dialect. after windowfunction is in, this rule is invalid when there are windowfunction in select, this pr is try to fix this. but now this resolution is not right, @yhuai any idea for this? |
Thank you for explanation, I meant the |
Ok, sorry, I understand eventually. |
We should keep adding the missed attributes into the |
I feel it is hard to fix it. Since we can end up having a chain of |
Yes, actually this PR is try to add the missing columns before we extract window expressions and add |
Test build #32786 has finished for PR 6169 at commit
|
Test build #32790 has finished for PR 6169 at commit
|
retest this please |
Test build #32803 has finished for PR 6169 at commit
|
the basic idea here is to ignore window expressions in ResolveSortReferences |
close this now, will reopen if find a more reasonable fix |
Jira: https://issues.apache.org/jira/browse/SPARK-7659
If there are
WindowExpression
in select clause, sorting by attributes that are not present in the child analyze failure. such as/cc @yhuai