[ 
https://issues.apache.org/jira/browse/SPARK-22548?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Felix Cheung updated SPARK-22548:
---------------------------------
    Target Version/s: 2.2.1, 2.3.0  (was: 2.3.0, 2.2.2)

> Incorrect nested AND expression pushed down to JDBC data source
> ---------------------------------------------------------------
>
>                 Key: SPARK-22548
>                 URL: https://issues.apache.org/jira/browse/SPARK-22548
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.2.0
>            Reporter: Jia Li
>            Assignee: Jia Li
>             Fix For: 2.1.3, 2.2.1, 2.3.0
>
>
> Let’s say I have a JDBC data source table ‘foobar’ with 3 rows:
> NAME          THEID
> ==================
> fred                  1
> mary                  2
> joe 'foo' "bar"    3
> This query returns incorrect result. 
> SELECT * FROM foobar WHERE (THEID > 0 AND TRIM(NAME) = 'mary') OR (NAME = 
> 'fred')
> It’s supposed to return:
> fred                  1
> mary                  2
> But it returns
> fred                  1
> mary                  2
> joe 'foo' "bar"    3
> This is because one leg of the nested AND predicate, TRIM(NAME) = 'mary’, can 
> not be pushed down but is lost during JDBC push down filter translation. The 
> same translation method is also called by Data Source V2. I have a fix for 
> this issue and will open a PR. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to