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

Fabian Hueske commented on FLINK-7730:
--------------------------------------

The pressing issue that needs to be fixed before the next release is to reject 
queries that compute wrong results.
This has to be done for the Table API and SQL interface before the logical 
RelNode plan is constructed.

1) Table API: Adjust the validation to prevent table function left outer joins 
with a predicate other than TRUE.
2) SQL: Adjust the SqlValidator to prevent outer joins against a lateral table 
with a predicate other than TRUE.

These changes will also reject local predicates that could have been pushed 
towards the table function (in Table API not SQL), but I'm OK with not 
supporting those yet because this has never worked before.
Support for local predicates can be added in a follow up issue. 

We can create the following sub issues:
- reject table function outer joins with predicates in Table API (BLOCKER for 
1.4.0)
- reject lateral table outer joins with predicates in SQL (BLOCKER for 1.4.0)
- add support for table function outer joins with local predicates

For everything else we need fixes in Calcite (unless we want to copy Calcite 
code and fix it in Flink).

> TableFunction LEFT OUTER joins with ON predicates are broken
> ------------------------------------------------------------
>
>                 Key: FLINK-7730
>                 URL: https://issues.apache.org/jira/browse/FLINK-7730
>             Project: Flink
>          Issue Type: Bug
>          Components: Table API & SQL
>    Affects Versions: 1.4.0, 1.3.2
>            Reporter: Fabian Hueske
>            Assignee: Xingcan Cui
>            Priority: Critical
>
> TableFunction left outer joins with predicates in the ON clause are broken. 
> Apparently, the are no tests for this and it has never worked. I observed 
> issues on several layers:
> - Table Function does not correctly validate equality predicate: 
> {{leftOuterJoin(func1('c) as 'd,  'a.cast(Types.STRING) === 'd)}} is rejected 
> because the predicate is not considered as an equality predicate (the cast 
> needs to be pushed down).
> - Plans cannot be correctly translated: {{leftOuterJoin(func1('c) as 'd,  'c 
> === 'd)}} gives an optimizer exception.
> - SQL queries get translated but produce incorrect results. For example 
> {{SELECT a, b, c, d FROM MyTable LEFT OUTER JOIN LATERAL TABLE(tfunc(c)) AS 
> T(d) ON d = c}} returns an empty result if the condition {{d = c}} never 
> returns true. However, the outer side should be preserved and padded with 
> nulls.
> So there seem to be many issues with table function outer joins. Especially, 
> the wrong result produced by SQL queries need to be quickly fixed.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to