AngersZhuuuu commented on a change in pull request #30145: URL: https://github.com/apache/spark/pull/30145#discussion_r514780876
########## File path: sql/core/src/test/resources/sql-tests/inputs/group-by-ordinal.sql ########## @@ -54,6 +54,26 @@ select count(a), a from (select 1 as a) tmp group by 2 having a > 0; -- mixed cases: group-by ordinals and aliases select a, a AS k, count(b) from data group by k, 1; +-- can use ordinal in CUBE +select a, b, count(1) from data group by cube(1, 2); Review comment: > could you add tests for the cases: `with rollup`/`with cube`? Updated. and ``` select a, b, count(1) from data group by cube(1, 2) with cube; ``` with throw ``` > select a, b, c from x group by cube(a, b, c) with cube; 20/10/30 11:16:24 ERROR SparkSQLDriver: Failed in [select a, b, c from x group by cube(a, b, c) with cube] java.lang.UnsupportedOperationException at org.apache.spark.sql.catalyst.expressions.GroupingSet.dataType(grouping.scala:36) at org.apache.spark.sql.catalyst.expressions.GroupingSet.dataType$(grouping.scala:36) ``` I will rase a pr to catch similar exception and throw an exception that is easy for the user to understand. Such as ``` we can't use `WITH CUBE ` and `cube func` together ``` ---------------------------------------------------------------- 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