GitHub user srinathshankar opened a pull request:

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

    [SPARK-17298][SQL] Require explicit CROSS join for cartesian products

    ## What changes were proposed in this pull request?
    
    Require the use of CROSS join syntax in SQL (and a new crossJoin
    DataFrame API) to specify explicit cartesian products between relations.
    By cartesian product we mean a join between relations R and S where
    there is no join condition involving columns from both R and S.
    
    If a cartesian product is detected in the absence of an explicit CROSS
    join, an error must be thrown. Turning on the
    "spark.sql.crossJoin.enabled" configuration flag will disable this check
    and allow cartesian products without an explicit CROSS join.
    
    The new crossJoin DataFrame API must be used to specify explicit cross
    joins. The existing join(DataFrame) method will produce a INNER join
    that will require a subsequent join condition.
    That is df1.join(df2) is equivalent to select * from df1, df2.
    
    ## How was this patch tested?
    
    Added cross-join.sql to the SQLQueryTestSuite to test the check for 
cartesian products. Added a couple of tests to the DataFrameJoinSuite to test 
the crossJoin API. Modified various other test suites to explicitly specify a 
cross join where an INNER join or a comma-separated list was previously used.
    
    
    
    


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

    $ git pull https://github.com/srinathshankar/spark crossjoin

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

    https://github.com/apache/spark/pull/14866.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 #14866
    
----
commit 250d96dcf43c09dbff821e5b20f3f0ea86f08887
Author: Srinath Shankar <[email protected]>
Date:   2016-08-25T16:43:08Z

    [SPARK-17298][SQL] Require explicit CROSS join for cartesian products
    
    Require the use of CROSS join syntax in SQL (and a new crossJoin
    DataFrame API) to specify explicit cartesian products between relations.
    By cartesian product we mean a join between relations R and S where
    there is no join condition involving columns from both R and S.
    
    If a cartesian product is detected in the absence of an explicit CROSS
    join, an error must be thrown. Turning on the
    "spark.sql.crossJoin.enabled" configuration flag will disable this check
    and allow cartesian products without an explicit CROSS join.
    
    The new crossJoin DataFrame API must be used to specify explicit cross
    joins. The existing join(DataFrame) method will produce a INNER join
    that will require a subsequent join condition.
    That is df1.join(df2) == select * from df1, df2.

----


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to