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

Martijn Visser updated FLINK-41818:
-----------------------------------
    Affects Version/s: 2.3.0
                       2.2.0
                       2.1.0

> Multi-way join returns wrong results when an outer join condition compares 
> two earlier inputs
> ---------------------------------------------------------------------------------------------
>
>                 Key: FLINK-41818
>                 URL: https://issues.apache.org/jira/browse/FLINK-41818
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Runtime
>    Affects Versions: 2.1.0, 2.2.0, 2.3.0
>            Reporter: Martijn Visser
>            Priority: Major
>
> With {{table.optimizer.multi-join.enabled}}, a LEFT JOIN whose ON clause 
> compares two earlier inputs can return wrong results. With a = (1, 1, NULL), 
> (1, 1, 2), b = (1, NULL, NULL) and c = (1, 2, 1), all (k, x, y):
> {code:sql}
> SELECT * FROM a LEFT JOIN b ON b.k = a.k LEFT JOIN c ON c.k = a.k AND a.y = 
> b.x
> {code}
> The binary joins join both rows of a with b. The multi-way join returns (1, 
> 1, 2, NULL, NULL, NULL, NULL, NULL, NULL), so it drops a match with b because 
> of a condition of the join with c. With JOIN b instead, it drops (1, NULL, 
> NULL, 1, 1, NULL, NULL, NULL, NULL) for a = (1, 2, 2), (1, NULL, NULL), b = 
> (1, 1, NULL) and c = (1, 2, 2).
> I think the cause is {{MultiJoinUtil#createJoinAttributeMap}}, which adds 
> {{a.y = b.x}} to the join attributes of b instead of c. This has been the 
> case since FLINK-37481.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to