-
Notifications
You must be signed in to change notification settings - Fork 347
Quote column names in JDBC schemaString #85
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
|
@marmbrus, do you think that we should perform similar quoting in Spark SQL's built-in JDBC datasource? Is this type of quoting a dialect-specific thing? These questions aren't blockers to making this change here in |
Current coverage is
|
|
Yeah, this is a known issue in Spark (SPARK-9505) as well. However there I think we will have to work it into dialects as I think different systems use different quoting mechanisms (at least Spark SQL is different than MySQL). Do we need to do the same thing when querying such columns? or do we already escape there? |
|
The JDBC dialect dev API already has a quoting mechanism defined. On Sep 13, 2015, at 12:00 PM, Michael Armbrust notifications@github.com Yeah, this is a known issue in Spark (SPARK-9505 Do we need to do the same thing when querying such columns? or do we — |
|
@marmbrus, we already wrap in quotes when querying; it looks like we were just missing support for this when creating tables. |
|
Going to merge this now. |
|
Added an unload to this test, just to make it clear that the read path is also covered. |
This patch modifies
JDBCWrapper.schemaStringto wrap column names in quotes, which is necessary in order to allow us to create tables with columns whose names are reserved words or which contain spaces. This fixes #80.Note that, by itself, this patch does not enable full support for creating Redshift tables with column names that contain spaces; we are currently constrained by Avro's schema validation rules (see #84).