GitHub user clockfly opened a pull request:

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

    [SPARK-15916][SQL] JDBC filter push down should respect operator precedence

    ## What changes were proposed in this pull request?
    
    This PR fixes the problem that the precedence order is messed when pushing 
where-clause expression to JDBC layer. 
    
    **Case 1:**
    
    For sql `select * from table where (a or b) and c`, the where-clause is 
wrongly converted to JDBC where-clause `a or (b and c)` after filter push down. 
The consequence is that JDBC may returns less or more rows than expected.
    
    **Case 2:**
    
    For sql `select * from table where always_false_condition`, the result 
table may not be empty if the JDBC RDD is partitioned using:
    ```
    spark.read.jdbc(url, table, predicates = Array("partition 1 where clause", 
"partition 2 where clause"...)
    ```
    
    ## How was this patch tested?
    
    Unit test.
    
    This PR also close #13640 


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

    $ git pull https://github.com/clockfly/spark SPARK-15916

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

    https://github.com/apache/spark/pull/13743.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 #13743
    
----
commit bcfef466ec4cc74c4fd6b6180a9008600c6ca07b
Author: hyukjinkwon <gurwls...@gmail.com>
Date:   2016-06-13T10:32:16Z

    Consider top level and/or precedence for parenthesis

commit 2f1ada38d6a50916b3f5c9a681e01d8f13c0ac4b
Author: Sean Zhong <seanzh...@databricks.com>
Date:   2016-06-17T21:10:34Z

    fix partition where clause pushdown

----


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