pan3793 commented on code in PR #44352: URL: https://github.com/apache/spark/pull/44352#discussion_r1432220550
########## sql/core/src/test/resources/sql-tests/inputs/having.sql: ########## @@ -33,3 +33,27 @@ 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: Resolve ORDER BY column with/without HAVING clause, while the column presents on SELECT list +SELECT k FROM hav GROUP BY k ORDER BY k; +SELECT k FROM hav GROUP BY k HAVING sum(v) > 2 ORDER BY k; Review Comment: updated, only retain the fixed SQL now ########## sql/core/src/test/resources/sql-tests/inputs/having.sql: ########## @@ -33,3 +33,27 @@ 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: Resolve ORDER BY column with/without HAVING clause, while the column presents on SELECT list +SELECT k FROM hav GROUP BY k ORDER BY k; +SELECT k FROM hav GROUP BY k HAVING sum(v) > 2 ORDER BY k; + +-- SPARK-28386: Resolve ORDER BY column with/without HAVING clause, while the column does not present on SELECT list +SELECT length(k) FROM hav GROUP BY k ORDER BY k; +SELECT length(k) FROM hav GROUP BY k HAVING sum(v) > 2 ORDER BY k; + +-- SPARK-28386: Resolve ORDER BY scalar function with/without HAVING clause, while the scalar function presents on SELECT list +SELECT length(k) FROM hav GROUP BY k ORDER BY length(k); +SELECT length(k) FROM hav GROUP BY k HAVING max(v) > 2 ORDER BY length(k); + +-- SPARK-28386: Resolve ORDER BY scalar function with/without HAVING clause, while the scalar function does not present on SELECT list +SELECT k FROM hav GROUP BY k ORDER BY length(k); +SELECT k FROM hav GROUP BY k HAVING max(v) > 2 ORDER BY length(k); Review Comment: updated -- 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: reviews-unsubscr...@spark.apache.org 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