beliefer commented on code in PR #44352: URL: https://github.com/apache/spark/pull/44352#discussion_r1428769800
########## sql/core/src/test/resources/sql-tests/inputs/having.sql: ########## @@ -33,3 +33,6 @@ SELECT c1 FROM VALUES (1, 2) as t(c1, c2) GROUP BY GROUPING SETS(t.c1) HAVING t. SELECT c1 FROM VALUES (1, 2) as t(c1, c2) GROUP BY CUBE(t.c1) HAVING t.c1 = 1; SELECT c1 FROM VALUES (1, 2) as t(c1, c2) GROUP BY ROLLUP(t.c1) HAVING t.c1 = 1; SELECT c1 FROM VALUES (1, 2) as t(c1, c2) GROUP BY t.c1 HAVING t.c1 = 1; + +-- SPARK-28386: Cannot resolve ORDER BY columns with GROUP BY and HAVING +SELECT k, sum(v) FROM hav GROUP BY k HAVING sum(v) > 2 ORDER BY sum(v) Review Comment: Good question! ########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveReferencesInSort.scala: ########## @@ -28,10 +28,11 @@ import org.apache.spark.sql.connector.catalog.CatalogManager * includes metadata columns as well. * 2. Resolves the column to a literal function which is allowed to be invoked without braces, e.g. * `SELECT col, current_date FROM t`. - * 3. If the child plan is Aggregate, resolves the column to [[TempResolvedColumn]] with the output - * of Aggregate's child plan. This is to allow Sort to host grouping expressions and aggregate - * functions, which can be pushed down to the Aggregate later. For example, - * `SELECT max(a) FROM t GROUP BY b ORDER BY min(a)`. Review Comment: Shall we obtain the example? -- 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]
