Uh oh!
There was an error while loading. Please reload this page.
[SPARK-6145][SQL] fix ORDER BY on nested fields - #5189
Conversation
SparkQA
commented
Mar 25, 2015
Test build #29187 has finished for PR 5189 at commit
|
cloud-fan
commented
Mar 26, 2015
Since we decide to resolve This test will fail, because we have mistakenly resolved |
There was a problem hiding this comment.
Even there is no missing in project, we still need to build new Sort with resolved SortOrder.
cloud-fan
commented
Mar 26, 2015
Another problem, for something like |
marmbrus
commented
Mar 26, 2015
@cloud-fan, thanks for the further comments. Regarding not resolving sort in in Which outputs: So given this, I think the current way we resolve things (i.e. first resolve based on what comes from the select clause and then fall back on its child only when this fails) is non-standard but what we must do to avoid breaking existing HiveQL queries. |
There was a problem hiding this comment.
Update comment? Seems we will not add UnresolvedGetField any more.
SparkQA
commented
Mar 26, 2015
Test build #29255 has finished for PR 5189 at commit
|
cloud-fan
commented
Mar 27, 2015
Ah, so |
SparkQA
commented
Mar 29, 2015
Test build #29367 has finished for PR 5189 at commit
|
yhuai
commented
Mar 29, 2015
LGTM |
This PR is based on work by cloud-fan in #4904, but with two differences: - We isolate the logic for Sort's special handling into `ResolveSortReferences` - We avoid creating UnresolvedGetField expressions during resolution. Instead we either resolve GetField or we return None. This avoids us going down the wrong path early on. Author: Michael Armbrust <michael@databricks.com> Closes#5189 from marmbrus/nestedOrderBy and squashes the following commits: b8cae45 [Michael Armbrust] fix another test 0f36a11 [Michael Armbrust] WIP 91820cd [Michael Armbrust] Fix bug. (cherry picked from commit cd48ca5) Signed-off-by: Michael Armbrust <michael@databricks.com> Conflicts: sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala
This PR is a improvement for #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
This PR is a improvement for apache#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> Closesapache#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
This PR is based on work by @cloud-fan in #4904, but with two differences:
ResolveSortReferences