rxin commented on code in PR #39134: URL: https://github.com/apache/spark/pull/39134#discussion_r1054923707
########## sql/core/src/test/resources/sql-tests/inputs/group-by-all.sql: ########## @@ -0,0 +1,71 @@ +-- group by all +-- see https://www.linkedin.com/posts/mosha_duckdb-firebolt-snowflake-activity-7009615821006131200-VQ0o + +create temporary view data as select * from values + ("USA", "San Francisco", "Reynold", 1, 11.0), + ("USA", "San Francisco", "Matei", 2, 12.0), + ("USA", "Berkeley", "Xiao", 3, 13.0), + ("China", "Hangzhou", "Wenchen", 4, 14.0), + ("China", "Shanghai", "Shanghaiese", 5, 15.0), + ("Korea", "Seoul", "Hyukjin", 6, 16.0), + ("UK", "London", "Sean", 7, 17.0) + as data(country, city, name, id, power); + +-- basic +select country, count(*) from data group by ALL; + +-- different case +select country, count(*) from data group by aLl; + +-- a column named "all" would still work +select all, city, count(*) from (select country as all, city, id from data) group by all, city; + +-- a column named "all" should take precedence over the normal group by all expansion +-- if all refers to the column, then the following should return 3 rows. +-- if all refers to the global aggregate, then 1 row. +SELECT count(1) FROM VALUES(1), (2), (3) AS T(all) GROUP BY all; Review Comment: I don't think we should do an one off merging of some resolution logic into ResolveReference. If we want to do it, we should do it together in one shot. (It's also not clear to me if we should actually merge all resolution 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. 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]
