1. [SPARK-25708][SQL] HAVING without GROUP BY means global aggregate (details)
Commit 78e133141ce8131c60181f947346802864b0951a by gatorsmile
[SPARK-25708][SQL] HAVING without GROUP BY means global aggregate
## What changes were proposed in this pull request?
According to the SQL standard, when a query contains `HAVING`, it
indicates an aggregate operator. For more details please refer to
However, in Spark SQL parser, we treat HAVING as a normal filter when
there is no GROUP BY, which breaks SQL semantic and lead to wrong
result. This PR fixes the parser.
## How was this patch tested?
new test
Closes #22696 from cloud-fan/having.
Authored-by: Wenchen Fan <> Signed-off-by:
gatorsmile <>
The file was modifiedsql/core/src/test/resources/sql-tests/inputs/group-by.sql (diff)
The file was modifiedsql/core/src/test/resources/sql-tests/results/group-by.sql.out (diff)
The file was modifiedsql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala (diff)
The file was modifieddocs/ (diff)
The file was modifiedsql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/PlanParserSuite.scala (diff)
The file was modifiedsql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala (diff)
The file was modifiedsql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala (diff)