Github user gatorsmile commented on the pull request:
https://github.com/apache/spark/pull/10678#issuecomment-172606524
Based on what @davies described, TPCDS Q12/Q20/Q98 still can't be resolved.
After investigation, the problem is caused by `Aggregate`:
- Group-by expressions in Aggregate: missing order-by attributes are not
allowed to be added into group-by expressions since it will change the query
result. Thus, in RDBMS, it is not allowed.
- Aggregate expressions in Aggregate: if the group-by expressions in
Aggregate contains the missing attributes but aggregate expressions do not have
it, just add them into the aggregate expressions. This can resolve the
analysisExceptions thrown by the three TCPDS queries.
You can see all these queries here:
https://github.com/databricks/spark-sql-perf/blob/master/src/main/scala/com/databricks/spark/sql/perf/tpcds/TPCDS_1_4_Queries.scala#L612
Another typical example is `Join`: ```select a.c1, b.c2 from t1 a, t1 b
order by b.c3, a.c3```.
After further discussion with @davies , `Filter` and the other UnaryNode
operators we can jump over when resolving sorting attributes.
---
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]