You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Piotr Czarnas (JIRA)" <ji...@apache.org> on 2016/06/13 08:00:30 UTC
[jira] [Created] (SPARK-15916) JDBC AND/OR operator push down does
not respect lower OR operator precedence
Piotr Czarnas created SPARK-15916:
-------------------------------------
Summary: JDBC AND/OR operator push down does not respect lower OR operator precedence
Key: SPARK-15916
URL: https://issues.apache.org/jira/browse/SPARK-15916
Project: Spark
Issue Type: Bug
Components: SQL
Affects Versions: 2.0.0
Reporter: Piotr Czarnas
A table from sql server Northwind database was registered as a JDBC dataframe.
A query was executed on Spark SQL, the "northwind_dbo_Categories" table is a temporary table which is a JDBC dataframe to "[northwind].[dbo].[Categories]" sql server table:
SQL executed on Spark sql context:
SELECT CategoryID FROM northwind_dbo_Categories
WHERE (CategoryID = 1 OR CategoryID = 2) AND CategoryName = 'Beverages'
Spark has done a proper predicate pushdown to JDBC, however parenthesis around two OR conditions was removed. Instead the following query was sent over JDBC to SQL Server:
SELECT "CategoryID" FROM [northwind].[dbo].[Categories] WHERE (CategoryID = 1) OR (CategoryID = 2) AND CategoryName = 'Beverages'
As a result, the last two conditions (around the AND operator) were considered as the highest precedence: (CategoryID = 2) AND CategoryName = 'Beverages'
Finally SQL Server has executed a query like this:
SELECT "CategoryID" FROM [northwind].[dbo].[Categories] WHERE CategoryID = 1 OR (CategoryID = 2 AND CategoryName = 'Beverages')
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org