[ 
https://issues.apache.org/jira/browse/IMPALA-13873?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17936574#comment-17936574
 ] 

Daniel Becker commented on IMPALA-13873:
----------------------------------------

More reduced versions that also produce the error:
{code:java}
select t.* from
(select
  a,
  b,
  min(b) over (partition by a) min_b
from
  (
    select
      10 a,
      10 b
  ) u1
union
select 10, 10, 20) t
where t.b = t.min_b;{code}
{code:java}
WITH u1 AS (select 10 a, 10 b),
t AS (select a, b, min(b) over (partition by a) min_b from u1 UNION select 10, 
10, 20)
select t.* from t where t.b = t.min_b;{code}

> 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
>            Priority: Major
>
> 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)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to