GitHub user gatorsmile opened a pull request:

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

    [SPARK-13527] [SQL] Prune Filters based on Constraints

    #### What changes were proposed in this pull request?
    
    Remove all the deterministic conditions in a [[Filter]] that are contained 
in the Child's Constraints.
    
    For example, the first query can be simplified to the second one.
    
    ```scala
        val queryWithUselessFilter = tr1
          .where("tr1.a".attr > 10 || "tr1.c".attr < 10)
          .join(tr2.where('d.attr < 100), Inner, Some("tr1.a".attr === 
"tr2.a".attr))
          .where(
            ("tr1.a".attr > 10 || "tr1.c".attr < 10) &&
            'd.attr < 100 &&
            "tr2.a".attr === "tr1.a".attr)
    ```
    ```scala
        val query = tr1
          .where("tr1.a".attr > 10 || "tr1.c".attr < 10)
          .join(tr2.where('d.attr < 100), Inner, Some("tr1.a".attr === 
"tr2.a".attr))
    ```
    #### How was this patch tested?
    
    Six test cases are added.

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

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

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

    https://github.com/apache/spark/pull/11406.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 #11406
    
----
commit c0caaea10993e5a74c09278461aac1c0a470411c
Author: gatorsmile <[email protected]>
Date:   2016-02-27T03:06:35Z

    Merge remote-tracking branch 'upstream/master' into FilterRemoval

commit e50d307ad7d3347b66938f267a601ea67107f563
Author: gatorsmile <[email protected]>
Date:   2016-02-27T03:07:08Z

    prune Filter based on Constraints

----


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