You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/05/27 12:25:12 UTC

[jira] [Commented] (FLINK-3944) Add optimization rules to reorder Cartesian products and joins

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

ASF GitHub Bot commented on FLINK-3944:
---------------------------------------

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 <fh...@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).

----


> Add optimization rules to reorder Cartesian products and joins
> --------------------------------------------------------------
>
>                 Key: FLINK-3944
>                 URL: https://issues.apache.org/jira/browse/FLINK-3944
>             Project: Flink
>          Issue Type: Bug
>          Components: Table API
>    Affects Versions: 1.1.0
>            Reporter: Fabian Hueske
>            Assignee: Fabian Hueske
>            Priority: Critical
>             Fix For: 1.1.0
>
>
> Currently, we do not support the execution of Cartesian products. 
> Because we do not optimize the order of joins (due to missing statistics), joins are executed in the order in which they are specified. This works well for the Table API, however it can be problematic in case of SQL queries where the order of tables in the FROM clause should not matter.
> In case of SQL queries, it can happen that the optimized plan contains Cartesian products because joins are not reordered. If we add optimization rules that switch Cartesian products and joins, such situations can be resolved.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)