You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Xiao Li (JIRA)" <ji...@apache.org> on 2017/11/22 04:14:00 UTC

[jira] [Resolved] (SPARK-22548) Incorrect nested AND expression pushed down to JDBC data source

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

Xiao Li resolved SPARK-22548.
-----------------------------
       Resolution: Fixed
         Assignee: Jia Li
    Fix Version/s: 2.3.0
                   2.2.1
                   2.1.3

> 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-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org