GitHub user fhueske opened a pull request: https://github.com/apache/flink/pull/2044
[FLINK-3944] [tableAPI] Add rewrite rules to reorder Cartesian products and joins. The Table API / SQL interface do not reorder joins due to missing stats and estimates. This can lead to situations where a query with two inner equi joins cannot be executed due to missing support for Cartesian products. For instance the following query would not be executed: ``` SELECT * FROM t1, t2, t3 WHERE t1.a = t3.a AND t2.b = t3.b ``` because the plan would first compute the Cartesian product of `t1` and `t2` because both are listed first in the `FROM` clause. This PR adds optimization rules to reorder joins and Cartesian products to resolve such situation. You can merge this pull request into a Git repository by running: $ git pull https://github.com/fhueske/flink tableCrossOrder Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/2044.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2044 ---- commit 760ffe29bc1e2f4462f453f378c06c7b1f980dee Author: Fabian Hueske <fhue...@apache.org> Date: 2016-05-27T11:04:12Z [FLINK-3944] [tableAPI] Add rewrite rules to reorder Cartesian products and joins. These rules are necessary to resolve join orders that initially contain Cartesian products due to the order in which base relations are added in the FROM clause (SQL) or joined (Table API). ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---