GitHub user cloud-fan opened a pull request:
https://github.com/apache/spark/pull/5659
[SPARK-7067][SQL] fix bug when use complex nested fields in ORDER BY
This PR is a improvement for https://github.com/apache/spark/pull/5189.
The resolution rule for ORDER BY is: first resolve based on what comes from
the select clause and then fall back on its child only when this fails.
There are 2 steps. First, try to resolve `Sort` in `ResolveReferences`
based on select clause, and ignore exceptions. Second, try to resolve `Sort` in
`ResolveSortReferences` and add missing projection.
However, the way we resolve `SortOrder` is wrong. We just resolve
`UnresolvedAttribute` and use the result to indicate if we can resolve
`SortOrder`. But `UnresolvedAttribute` is only part of `GetField` chain(broken
by `GetItem`), so we need to go through the whole chain to indicate if we can
resolve `SortOrder`.
With this change, we can also avoid re-throw GetField exception in
`CheckAnalysis` which is little ugly.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/cloud-fan/spark order-by
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/5659.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #5659
----
commit 98cf467aef20ca53b790f2f4cc29f380e1901f1f
Author: Wenchen Fan <[email protected]>
Date: 2015-04-23T09:42:35Z
fix SPARK-7067
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]