mirror of
https://github.com/apache/impala.git
synced 2026-01-04 09:00:56 -05:00
IMPALA-1550: Invalid rewrite when EXISTS subqueries contain aggregate
functions This commit fixes an issue where a [NOT] EXISTS subquery that contains an aggregate function will sometimes be incorrectly rewritten into a join, thereby returning incorrect results. Change-Id: I18b211d76ee3de77d8061603ff5bb1fbceae2e60 Reviewed-on: http://gerrit.cloudera.org:8080/266 Reviewed-by: Dimitris Tsirogiannis <dtsirogiannis@cloudera.com> Tested-by: Internal Jenkins
This commit is contained in:
committed by
Internal Jenkins
parent
672ae91732
commit
4eceeacf16
@@ -759,3 +759,31 @@ UNION ALL SELECT 3
|
||||
---- TYPES
|
||||
TINYINT
|
||||
====
|
||||
---- QUERY
|
||||
# Correlated NOT EXISTS subquery with an aggregate function (IMPALA-1550)
|
||||
SELECT t1.bigint_col
|
||||
FROM alltypestiny t1
|
||||
WHERE NOT EXISTS
|
||||
(SELECT SUM(smallint_col) AS int_col
|
||||
FROM alltypestiny
|
||||
WHERE t1.date_string_col = string_col AND t1.timestamp_col = timestamp_col)
|
||||
GROUP BY t1.bigint_col
|
||||
---- RESULTS
|
||||
---- TYPES
|
||||
BIGINT
|
||||
====
|
||||
---- QUERY
|
||||
# Correlated EXISTS subquery with an aggregate function (IMPALA-1550)
|
||||
SELECT t1.bigint_col
|
||||
FROM alltypestiny t1
|
||||
WHERE EXISTS
|
||||
(SELECT SUM(smallint_col) AS int_col
|
||||
FROM alltypestiny
|
||||
WHERE t1.date_string_col = string_col AND t1.timestamp_col = timestamp_col)
|
||||
GROUP BY t1.bigint_col
|
||||
---- RESULTS
|
||||
0
|
||||
10
|
||||
---- TYPES
|
||||
BIGINT
|
||||
====
|
||||
|
||||
Reference in New Issue
Block a user