Github user fhueske commented on a diff in the pull request: https://github.com/apache/flink/pull/4830#discussion_r144809063 --- Diff: flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/batch/table/CorrelateTest.scala --- @@ -98,4 +103,17 @@ class CorrelateTest extends TableTestBase { util.verifyTable(result, expected) } + + /** + * Due to the improper translation of TableFunction left outer join (see CALCITE-2004), we could + * only accept local join predicates on the left table. + */ + @Test (expected = classOf[TableException]) + def testLeftOuterJoinWithPredicates(): Unit = { + val util = batchTestUtil() + val table = util.addTable[(Int, Long, String)]("MyTable", 'a, 'b, 'c) + val function = util.addFunction("func1", new TableFunc1) + val result = table.leftOuterJoin(function('c) as 's).select('c, 's).where('s === "")// forbidden --- End diff -- This is actually OK. The semantics of join predicates in the `ON` and `WHERE` clauses are different for outer joins. `WHERE` predicates are applied after the join, `ON` predicates are applied with the join.
---