diff options
author | Wenchen Fan <cloud0fan@outlook.com> | 2015-06-17 14:46:00 -0700 |
---|---|---|
committer | Michael Armbrust <michael@databricks.com> | 2015-06-17 14:46:00 -0700 |
commit | 7f05b1fe696daa28fee514c9aef805be5913cfcd (patch) | |
tree | ceeeb3e7afd2227f290cb51d3c28cc1f477e3cba /sql/hive/src | |
parent | a411a40de2209c56e898e3fb4af955d7b55af11c (diff) | |
download | spark-7f05b1fe696daa28fee514c9aef805be5913cfcd.tar.gz spark-7f05b1fe696daa28fee514c9aef805be5913cfcd.tar.bz2 spark-7f05b1fe696daa28fee514c9aef805be5913cfcd.zip |
[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.
Author: Wenchen Fan <cloud0fan@outlook.com>
Closes #5659 from cloud-fan/order-by and squashes the following commits:
cfa79f8 [Wenchen Fan] update test
3245d28 [Wenchen Fan] minor improve
465ee07 [Wenchen Fan] address comment
1fc41a2 [Wenchen Fan] fix SPARK-7067
Diffstat (limited to 'sql/hive/src')
0 files changed, 0 insertions, 0 deletions