-
Notifications
You must be signed in to change notification settings - Fork 28.7k
[SPARK-6888][SQL] Export driver quirks #5498
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
This needs a JIRA -- see https://cwiki.apache.org/confluence/display/SPARK/Contributing+to+Spark |
Added a ticket: https://issues.apache.org/jira/browse/SPARK-6888 |
Make it possible to (temporary) overwrite the driver quirks. This can be used to overcome problems with specific schemas or to add new jdbc driver support on the fly.
dca9372
to
9ca66d9
Compare
ok to test. |
|
||
private var quirks = List[DriverQuirks]() | ||
|
||
def registerQuirks(quirk: DriverQuirks) { |
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.
Please add return type explicitly for all public methods.
@liancheng thank you, will updaste the patch. |
} else { | ||
r.getCatalystType(sqlType, typeName, size, md) | ||
} | ||
) |
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.
How about this:
quirks.map(_.getCatalystType(sqlType, typeName, size, md)).collectFirst {
case dataType if dataType != null => dataType
}.orNull
You may just add new commits to this PR. Also, would you please add tests for this feature? |
Test build #30332 has finished for PR 5498 at commit
|
I still have to write tests for AggregatedQuirks. |
If we are going to make this a public API we should consider a clearer name. Perhaps. |
@@ -39,33 +39,68 @@ import java.sql.Types | |||
* if `getJDBCType` returns `(null, None)`, the default type handling is used | |||
* for the given Catalyst type. | |||
*/ | |||
private[sql] abstract class DriverQuirks { | |||
abstract class DriverQuirks { | |||
def canHandle(url : String): Boolean |
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.
Add scala doc to describe the contract for each of these methods.
Test build #30375 has finished for PR 5498 at commit
|
@marmbrus thank you, I'll fix those issues and open a new one when done. Regarding naming/api: It is quite common that there is one class per sql/jdbc dialect. Often called that way (e.g. MySQLDialect on hibernate). I've found quite some projects that use the same naming (via github search). On the other hand it's currently just doing type mapping. So JDBCTypeMapping would be a very valid name, too. It would restrict the use case more (can be good or bad). I guess you know better what would suite spark :-) |
|
We will also want to mark all of these |
Test build #30463 has finished for PR 5498 at commit
|
Replaced by #5555 |
Make it possible to (temporary) overwrite the driver quirks. This
can be used to overcome problems with specific schemas or to
add new jdbc driver support on the fly.
A very simple implementation to dump the loading can be done like this (spark-shell)
Not that this pull request is against 1.3 - I could not create a distribution with the current master.