[ 
https://issues.apache.org/jira/browse/FLINK-40922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated FLINK-40922:
-----------------------------------
    Labels: pull-request-available  (was: )

> DISTINCT over GROUP BY ROLLUP returns duplicate rows
> ----------------------------------------------------
>
>                 Key: FLINK-40922
>                 URL: https://issues.apache.org/jira/browse/FLINK-40922
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>    Affects Versions: 2.3.0
>            Reporter: Yaoxuan Wu
>            Priority: Major
>              Labels: pull-request-available
>
> When all grouping keys of a ROLLUP group are NULL, that group's row can be 
> identical to the grand-total row. A DISTINCT on top of the rollup must 
> collapse the two rows, but Flink returns both.
>  
> {code:java}
> SELECT DISTINCT * FROM (
>   SELECT k, COUNT(x) AS c
>   FROM (VALUES (CAST(NULL AS INT), 1), (CAST(NULL AS INT), 2)) AS v(k, x)
>   GROUP BY ROLLUP(k)
> ); {code}
>  
>  
> The inner query's result is two rows (which is correct)
> {code:java}
> +-------------+----------------------+
> |           k |                    c |
> +-------------+----------------------+
> |      <NULL> |                    2 |
> |      <NULL> |                    2 |
> +-------------+----------------------+ {code}
> But the DISTINCT over the inner query still returns two rows. (the same as 
> above)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to