Github user cloud-fan commented on the pull request:
https://github.com/apache/spark/pull/9844#issuecomment-158846201
In
[`ResolveAggregateFunctions`](https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala#L633-L635),
we pick up all `SortOrder`s and put them in aggregate list to resolve them.
However, logically we should only pick unresolved `SortOrder`s as some of them
may already be resolved at
[`ResolveReferences`](https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala#L431-L435).
In your case, the `a` in `order by a, c2` can and only can be resolved in
`ResolveReferences`, so we should skip the `a` in `ResolveAggregateFunctions`.
Does it make sense to you?
---
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]