Custom JDBC column types#220
Closed
marctrem wants to merge 3 commits into
Closed
Conversation
Contributor
|
Seems reasonable to me; do you mind adding a simple test which exercises this code path? |
Signed-off-by: Marc-André Tremblay <marcandre.tr@gmail.com>
Contributor
Author
|
Sorry for the delay. I based the test on the existing "maxlength" feature test. |
| case _ => throw new IllegalArgumentException(s"Don't know how to save $field to JDBC") | ||
| val typ: String = if (field.metadata.contains("redshift_type")) { | ||
| field.metadata.getString("redshift_type") | ||
| } |
Contributor
There was a problem hiding this comment.
Minor style nit: place the else on the same line as this brace.
Contributor
|
LGTM. I'll try to fix the style issue and merge conflicts myself. |
nrstott
pushed a commit
to nrstott/spark-redshift
that referenced
this pull request
Aug 1, 2016
Author: Marc-André Tremblay <marcandre.tr@gmail.com> This patch had conflicts when merged, resolved by Committer: Josh Rosen <joshrosen@databricks.com> Closes databricks#220 from marctrem/custom-jdbc-column-types.
|
@JoshRosen We are facing the same issue in the general JDBC data source of Spark. What do you think if we do it in Spark too? |
Contributor
|
@gatorsmile, I wouldn't be opposed. |
|
Thanks! |
|
@JoshRosen We submitted two solutions:
I am wondering which solution you prefer? It sounds like the first one is more user friendly. val mdb = new MetadataBuilder()
mdb.putString("name", "VARCHAR(128)”)
mdb.putString("comments”, “CLOB(20K)”)
val createTableColTypes = mdb.build().json
df.write.option("createTableColumnTypes", createTableColTypes).jdbc(url, "TEST.DBCOLTYPETEST", properties) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This patch allows us to set custom column types.
Please tell me if you want some edits on it.
Thank you,
Marc