Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/4830#discussion_r144808753
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/rules/dataSet/DataSetCalcRule.scala
---
@@ -32,7 +34,19 @@ class DataSetCalcRule
FlinkConventions.DATASET,
"DataSetCalcRule") {
- def convert(rel: RelNode): RelNode = {
+ override def matches(call: RelOptRuleCall): Boolean = {
--- End diff --
Unfortunately, this check is too restrictive because it also rejects valid
queries. For example the query
```
SELECT a, b, c, x, y
FROM t LEFT JOIN LATERAL TABLE(udtf(a)) as s(x, y) ON TRUE
WHERE a = c
```
would be a valid query and be rejected by this condition.
The problem is that a plan of Calcite RelNode cannot distinguish `ON` and
`WHERE` predicates.
Hence we need to fix this before we generate the logical `RelNode` plan,
i.e., during query validation in SQL and Table API.
---