Github user fhueske commented on a diff in the pull request: https://github.com/apache/flink/pull/5241#discussion_r160438113 --- Diff: flink-libraries/flink-table/src/test/scala/org/apache/flink/table/runtime/batch/sql/JoinITCase.scala --- @@ -254,7 +254,7 @@ class JoinITCase( val table = CollectionDataSets.getSmall3TupleDataSet(env).toTable(tEnv).as('a1, 'a2, 'a3) tEnv.registerTable("A", table) - val sqlQuery2 = "SELECT * FROM (SELECT count(*) FROM A) CROSS JOIN A" --- End diff -- The test was working correctly before. If you remove all your changes, the test will pass. It started to fail when you added the count aggregate that is not null-aware. It does not matter which rules are applied during optimization as long as the query computes for the given input data the correct result. The test is correct and is failing due to the changes of the PR. Hence, the PR breaks the correctness of some queries that were working before. IMO, we cannot merge it in the current state. We have to fix FLINK-8355 before we can merge this PR. I have an idea how to fix FLINK-8355 and will add that to the ticket.
---