GitHub user maropu opened a pull request:

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

    [SPARK-13484][SQL] Prevent illegal NULL propagation when filtering 
outer-join results

    ## What changes were proposed in this pull request?
    This pr is to prevent illegal NULL propagation in the query below;
    ```
    val a = sqlContext.range(10).select(col("id"), lit(0).as("count"))
    val b = sqlContext.range(10).select((col("id") % 
3).as("id")).groupBy("id").count()
    a.join(b, a("id") === b("id"), "left_outer").filter(b("count").isNull)
    ```
    It returns nothing because `b("count")` is not nullable and the filter 
condition is always false by `Optimizer`.
    
    ## How was this patch tested?
    Added a test for the query above in `DataFrameJoinSuite`.
    
    


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

    $ git pull https://github.com/maropu/spark spark13484

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

    https://github.com/apache/spark/pull/11371.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 #11371
    
----
commit 9f8ff3d5c487e838f5a634dfb04d106ed4d41aa3
Author: Takeshi YAMAMURO <[email protected]>
Date:   2016-02-25T15:56:29Z

    Avoid irregal NULL propagation

----


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