Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
Impala 1.4.1
-
None
Description
Complex exprs in correlated predicates result in wrong query subquery rewrites.
In the following query, the generated inline view generates a group by clause on t1.id, t2.id instead of t1.id + t2.id:
select 1
from functional.alltypestiny t
where
(select sum(t1.id)
from functional.alltypesagg t1 inner join functional.alltypes t2 on t1.id = t2.id
where t1.id + t2.id = t.int_col) = t.int_col
+-----------------------------------------------------------------------+
| Explain String |
+-----------------------------------------------------------------------+
| Estimated Per-Host Requirements: Memory=160.01MB VCores=2 |
| |
| 12:EXCHANGE [UNPARTITIONED] |
| | |
| 05:HASH JOIN [RIGHT SEMI JOIN, PARTITIONED] |
| | hash predicates: sum(t1.id) = t.int_col, t1.id + t2.id = t.int_col |
| | |
| |--11:EXCHANGE [HASH(t.int_col,t.int_col)] |
| | | |
| | 00:SCAN HDFS [functional.alltypestiny t] |
| | partitions=4/4 size=460B |
| | |
| 10:EXCHANGE [HASH(sum(t1.id),t1.id + t2.id)] |
| | |
| 09:AGGREGATE [FINALIZE] |
| | output: sum:merge(t1.id) |
| | group by: t1.id, t2.id |
| | |
| 08:EXCHANGE [HASH(t1.id,t2.id)] |
| | |
| 04:AGGREGATE |
| | output: sum(t1.id) |
| | group by: t1.id, t2.id |
| | |
| 03:HASH JOIN [INNER JOIN, PARTITIONED] |
| | hash predicates: t1.id = t2.id |
| | |
| |--07:EXCHANGE [HASH(t2.id)] |
| | | |
| | 02:SCAN HDFS [functional.alltypes t2] |
| | partitions=24/24 size=478.45KB |
| | |
| 06:EXCHANGE [HASH(t1.id)] |
| | |
| 01:SCAN HDFS [functional.alltypesagg t1] |
| partitions=11/11 size=814.73KB |
+-----------------------------------------------------------------------+