-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-24288][SQL] Add a JDBC Option to enable preventing predicate pushdown #21875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thanks! :) LGTM except two minor comments |
| val sessionInitStatement = parameters.get(JDBC_SESSION_INIT_STATEMENT) | ||
|
|
||
| // An option to allow/disallow pushing down predicate into JDBC data source | ||
| val pushDownPredicate = parameters.getOrElse(JDBC_PUSHDOWN_PREDICATE, "true").toBoolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super Nit: Shouldn't it be in plural, pushDownPredicates? There may be many predicates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or one could argue that "predicate" is a notion of all filters as a whole. It's a nice reminder though. I had not thought about it, but anyway I just checked: we use PushDownPredicate and the singular form in similar rules. So maybe we keep it singular here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, consistency is a very good argument :) Indeed it will be plural or not, depending from which side we are looking at it
| // Check if JDBCRDD.compileFilter can accept input filters | ||
| override def unhandledFilters(filters: Array[Filter]): Array[Filter] = { | ||
| filters.filter(JDBCRDD.compileFilter(_, JdbcDialects.get(jdbcOptions.url)).isEmpty) | ||
| if (jdbcOptions.pushDownPredicate) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure, that this is the only place? JDBCRDD.scanTable defines filters as all filters that may be pushed down. Probably we should use filters -- unhandledFilters in JdbcRelation.buildScan
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is the only source of truth for defining handled/unhandled. The caller (physical rules) calls this method and push "handled" to JdbcRelation.buildScan.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see now, my mistake. Thanks for clarification :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. I share your opinion actually. It is confusing here... maybe we should change the parameter names at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed it's confusing. buildScan argument may be named pushedFilters, variables also, then code will be self-describing
|
Can you add JDBC to the title? |
|
Test build #93562 has finished for PR 21875 at commit
|
|
@maryannxue We need to update the programming guide ? |
|
Programming guide updated. Thank you, @dilipbiswal and @HyukjinKwon! |
|
@maryannxue Thanks. It looks good to me. As a minor comment, could we state the default value for this parameter as well ? For some of the other parameters, we specify the default value. |
|
Test build #93579 has finished for PR 21875 at commit
|
|
Test build #93584 has finished for PR 21875 at commit
|
|
retest this please |
|
Test build #93647 has finished for PR 21875 at commit
|
gatorsmile
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
Thanks! Merged to master. |
What changes were proposed in this pull request?
Add a JDBC Option "pushDownPredicate" (default
true) to allow/disallow predicate push-down in JDBC data source.How was this patch tested?
Add a test in
JDBCSuite