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/results/having.sql.out | |
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/results/having.sql.out')
-rw-r--r-- | sql/core/src/test/resources/sql-tests/results/having.sql.out | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sql/core/src/test/resources/sql-tests/results/having.sql.out b/sql/core/src/test/resources/sql-tests/results/having.sql.out index e092383267..d87ee52216 100644 --- a/sql/core/src/test/resources/sql-tests/results/having.sql.out +++ b/sql/core/src/test/resources/sql-tests/results/having.sql.out @@ -1,5 +1,5 @@ -- Automatically generated by SQLQueryTestSuite --- Number of queries: 4 +-- Number of queries: 5 -- !query 0 @@ -38,3 +38,12 @@ SELECT MIN(t.v) FROM (SELECT * FROM hav WHERE v > 0) t HAVING(COUNT(1) > 0) struct<min(v):int> -- !query 3 output 1 + + +-- !query 4 +SELECT a + b FROM VALUES (1L, 2), (3L, 4) AS T(a, b) GROUP BY a + b HAVING a + b > 1 +-- !query 4 schema +struct<(a + CAST(b AS BIGINT)):bigint> +-- !query 4 output +3 +7 |