Peter Rozsa created IMPALA-13873:
------------------------------------
Summary: Missing equivalence conjunct in aggregation node with
inline views
Key: IMPALA-13873
URL: https://issues.apache.org/jira/browse/IMPALA-13873
Project: IMPALA
Issue Type: Bug
Components: Frontend
Affects Versions: Impala 4.5.0
Reporter: Peter Rozsa
The following query yields incorrect results:
select t.* from
(select
a,
b,
min(b) over (partition by a) min_b
from
(
select
10 a,
10 b
union
select
10 a,
20 b
union
select
10 a,
10 b
) u1
union
select 10, 10, 20) t
where t.b = t.min_b;
Result:
+----+----+-------+
| a | b | min_b |
+----+----+-------+
| 10 | 20 | 10 |
| 10 | 10 | 20 |
| 10 | 10 | 10 |
+----+----+-------+
Correct result:
+----+----+-------+
| a | b | min_b |
+----+----+-------+
| 10 | 10 | 10 |
+----+----+-------+
The underlying cause is that at the analyze part, the filter conjunct (t.b =
t.min_b) is removed at
[https://github.com/apache/impala/blob/356b7e5ddf7868968fb76ca55a8046d0291388fd/fe/src/main/java/org/apache/impala/analysis/Analyzer.java#L2955]
This conjunct should not be removed.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)