Details
Description
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.