diff options
author | Herman van Hovell <hvanhovell@databricks.com> | 2017-04-21 10:06:12 +0800 |
---|---|---|
committer | Wenchen Fan <wenchen@databricks.com> | 2017-04-21 10:06:12 +0800 |
commit | 760c8d088df1d35d7b8942177d47bc1677daf143 (patch) | |
tree | 86e975adf8963dd5455a2f9c11607a9974c21373 /sql/core/src/test/resources/sql-tests/inputs/having.sql | |
parent | 0368eb9d86634c83b3140ce3190cb9e0d0b7fd86 (diff) | |
download | spark-760c8d088df1d35d7b8942177d47bc1677daf143.tar.gz spark-760c8d088df1d35d7b8942177d47bc1677daf143.tar.bz2 spark-760c8d088df1d35d7b8942177d47bc1677daf143.zip |
[SPARK-20329][SQL] Make timezone aware expression without timezone unresolved
## What changes were proposed in this pull request?
A cast expression with a resolved time zone is not equal to a cast expression without a resolved time zone. The `ResolveAggregateFunction` assumed that these expression were the same, and would fail to resolve `HAVING` clauses which contain a `Cast` expression.
This is in essence caused by the fact that a `TimeZoneAwareExpression` can be resolved without a set time zone. This PR fixes this, and makes a `TimeZoneAwareExpression` unresolved as long as it has no TimeZone set.
## How was this patch tested?
Added a regression test to the `SQLQueryTestSuite.having` file.
Author: Herman van Hovell <hvanhovell@databricks.com>
Closes #17641 from hvanhovell/SPARK-20329.
Diffstat (limited to 'sql/core/src/test/resources/sql-tests/inputs/having.sql')
-rw-r--r-- | sql/core/src/test/resources/sql-tests/inputs/having.sql | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/core/src/test/resources/sql-tests/inputs/having.sql b/sql/core/src/test/resources/sql-tests/inputs/having.sql index 364c022d95..868a911e78 100644 --- a/sql/core/src/test/resources/sql-tests/inputs/having.sql +++ b/sql/core/src/test/resources/sql-tests/inputs/having.sql @@ -13,3 +13,6 @@ SELECT count(k) FROM hav GROUP BY v + 1 HAVING v + 1 = 2; -- SPARK-11032: resolve having correctly SELECT MIN(t.v) FROM (SELECT * FROM hav WHERE v > 0) t HAVING(COUNT(1) > 0); + +-- SPARK-20329: make sure we handle timezones correctly +SELECT a + b FROM VALUES (1L, 2), (3L, 4) AS T(a, b) GROUP BY a + b HAVING a + b > 1; |