Skip to content

Conversation

@clockfly
Copy link
Contributor

@clockfly clockfly commented Jun 17, 2016

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 where-clause:

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

@SparkQA
Copy link

SparkQA commented Jun 17, 2016

Test build #60729 has finished for PR 13743 at commit 2f1ada3.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@liancheng
Copy link
Contributor

LGTM

@liancheng
Copy link
Contributor

Merging to master and branch-2.0.

@asfgit asfgit closed this in ebb9a3b Jun 18, 2016
asfgit pushed a commit that referenced this pull request Jun 18, 2016
…edence

## 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 where-clause:
```
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

Author: hyukjinkwon <[email protected]>
Author: Sean Zhong <[email protected]>

Closes #13743 from clockfly/SPARK-15916.

(cherry picked from commit ebb9a3b)
Signed-off-by: Cheng Lian <[email protected]>
zzcclp added a commit to zzcclp/spark that referenced this pull request Jul 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants