Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ private[sql] class JDBCRDD(
* `filters`, but as a WHERE clause suitable for injection into a SQL query.
*/
private val filterWhereClause: String =
filters.flatMap(JDBCRDD.compileFilter).mkString(" AND ")
filters.flatMap(JDBCRDD.compileFilter).map(p => s"($p)").mkString(" AND ")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


/**
* A WHERE clause representing both `filters`, if any, and the current partition.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ class JDBCSuite extends SparkFunSuite
assert(checkPushdown(sql("SELECT * FROM foobar WHERE NAME LIKE 'fr%'")).collect().size == 1)
assert(checkPushdown(sql("SELECT * FROM foobar WHERE NAME LIKE '%ed'")).collect().size == 1)
assert(checkPushdown(sql("SELECT * FROM foobar WHERE NAME LIKE '%re%'")).collect().size == 1)
val orPrecedenceSql =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a jira id in the comments?

"SELECT * FROM foobar WHERE (NAME = 'fred' OR THEID = 100) AND THEID < 1"
assert(checkPushdown(sql(orPrecedenceSql)).collect().size == 0)

assert(checkPushdown(sql("SELECT * FROM nulltypes WHERE A IS NULL")).collect().size == 1)
assert(checkPushdown(sql("SELECT * FROM nulltypes WHERE A IS NOT NULL")).collect().size == 0)

Expand Down