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

Yaoxuan Wu commented on FLINK-41039:
------------------------------------

Hi [~manish1337],

Thanks for looking into this! Your proposed fix sounds good to me. I don’t have 
permission to assign issues, but hopefully a committer can help with the 
assignment.

Happy to help with testing if needed!

>       A projection on top of EXCEPT ALL or INTERSECT ALL is pushed into both 
> inputs and changes the result
> -----------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-41039
>                 URL: https://issues.apache.org/jira/browse/FLINK-41039
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>    Affects Versions: 2.3.0
>            Reporter: Yaoxuan Wu
>            Priority: Major
>
> {code:sql}
> SELECT x, y FROM (VALUES (1, 10)) AS a(x, y)
> EXCEPT ALL
> SELECT x, y FROM (VALUES (2, 10)) AS b(x, y);
> -- (1, 10)   correct
> SELECT y FROM (
>   SELECT x, y FROM (VALUES (1, 10)) AS a(x, y)
>   EXCEPT ALL
>   SELECT x, y FROM (VALUES (2, 10)) AS b(x, y));
> -- expected: 10
> -- actual:   (no rows)
> {code}
> {{ProjectSetOpTransposeRule}} pushes the projection {{y}} into both inputs, 
> so the EXCEPT ALL is computed on {{y}} alone and the two rows cancel. The 
> rule only refuses distinct set operations, but pushing a projection is only 
> safe for UNION ALL. INTERSECT ALL is wrong in the same way (it returns rows 
> that should not match). Streaming mode is affected too.
> Reproduces on 2.0.1, 2.2.1, 2.3.0 and master.



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

Reply via email to