[
https://issues.apache.org/jira/browse/FLINK-41039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18132462#comment-18132462
]
Manish commented on FLINK-41039:
--------------------------------
Hi [~thaddywu]
I have raised a [PR|https://github.com/apache/flink/pull/29614] and tested on
my side, can you please take a look and test as well when you get a chance?
Thanks
> 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
> Labels: pull-request-available
>
> {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
(v10.3.26#10030026)