GitHub user gatorsmile opened a pull request:

    https://github.com/apache/spark/pull/16762

    [SPARK-19419] [SPARK-19420] Fix the cross join detection

    ### What changes were proposed in this pull request?
    There are two issues in the existing detection of cartesian products. 
    
    1) When users use the outer joins where both sides of the tables are unable 
to be broadcasted, Spark will still select `BroadcastNestedLoopJoin`. CROSS 
JOIN syntax is unable to cover the scenario of outer join, but we still issue 
the following error message:
    ```
    Use the CROSS JOIN syntax to allow cartesian products between these 
relations
    ```
    
    2) The existing detection is unable to cover all the cartesian product 
cases. For example, 
      - Case 1) having non-equal predicates in join conditiions of an inner 
join.
      - Case 2) equi-join's key columns are not sortable and both sides are not 
small enough for broadcasting.
    
    This PR is to move the cross-join detection back to 
`BroadcastNestedLoopJoinExec` and `CartesianProductExec`. 
    
    ### How was this patch tested?
    Added the extra test cases.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/gatorsmile/spark crossJoin

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/16762.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 #16762
    
----
commit e4e3c9b84993ca415a1d07bcb07f20393c6fd5b4
Author: gatorsmile <gatorsm...@gmail.com>
Date:   2017-02-01T05:47:04Z

    fix.

----


---
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.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to