sqlwindspeaker opened a new pull request #30781: URL: https://github.com/apache/spark/pull/30781
### What changes were proposed in this pull request? See SPARK-22748, sql like: ``` create table temp.test_grouping_replace(a int, b int); select grouping__id from (select a, b, count(1) , grouping__id from temp.test_grouping_replace group by a, b grouping sets(a, b)) ``` will raise an error like > Error in query: grouping_id() can only be used with GroupingSets/Cube/Rollup;; This is because Spark translate grouping__id to grouping_id() every when it occurs, actually the 'grouping__id' in outer query is only a attribute reference to inner query, not a new function. ### Why are the changes needed? Also user can add alias to avoid this problem, but since fix this problem is not difficult, I guess we should fix it to make user use spark easier. ### How was this patch tested? New Test added in AnalysisSuite ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org