cxzl25 opened a new pull request, #36265: URL: https://github.com/apache/spark/pull/36265
### What changes were proposed in this pull request? When the expression of `sortOrder` has the name of `UnresolvedAttribute` in the alias of `Aggregate`, use the original expression. ### Why are the changes needed? The alias of `Aggregate` overwrites the field name, which causes an error in the `sortOrder` field parsing, and then the SQL cannot be executed. ```sql select sum(id) as id from range(10) group by id order by sum(id); ``` ``` Error in query: Resolved attribute(s) id#0L missing from id#1L in operator !Aggregate [id#1L], [sum(id#1L) AS id#0L, sum(id#0L) AS sum(id#0L)#4L]. Attribute(s) with the same name appear in the operation: id. Please check if the right attribute(s) are used.; Project [id#0L] +- Sort [sum(id#0L)#4L ASC NULLS FIRST], true +- !Aggregate [id#1L], [sum(id#1L) AS id#0L, sum(id#0L) AS sum(id#0L)#4L] +- Range (0, 10, step=1, splits=None) ``` ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? add UT -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
