-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-37931][SQL] Quote the column name if needed #35227
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
4ad25a8 to
ec172e4
Compare
ec172e4 to
e5abd64
Compare
|
@cloud-fan Could you take a look ? Thank you very much. |
Let's be specific here. This only affects schema DDL string AFAIK, while "get the table metadata" is low-level operation and it's scarying to change it. |
|
looks fine and I can't think of any breaking cases. cc @HyukjinKwon @viirya as well |
I found that the |
|
thanks, merging to master! |
|
Yeah, I think this is fine. |
| `c` CHAR(5), | ||
| `v` VARCHAR(6)) | ||
| c CHAR(5), | ||
| v VARCHAR(6)) |
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 noticed that the view test in this file still has quotes. ShowCreateTableCommand has a branch for view, and we need to update the quoting logic in that branch as well. @Peng-Lei
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.
Sorry, I left this out. I will do it by a follow up.
### What changes were proposed in this pull request? Quote the column name of view when `SHOW CREATE TABLE` for view. ### Why are the changes needed? follow up the [#PR](#35227). Keep the consistent between table and view when `SHOW CREATE TABLE`. ### Does this PR introduce _any_ user-facing change? Yes,It will change the result of `SHOW CREATE TABLE` for view. eg: ``` "STRUCT<`_c0`, `_c1`>" => "STRUCT<_c0, _c1>" ``` ### How was this patch tested? existed testcase. Closes #35351 from Peng-Lei/view-quote-columns. Authored-by: PengLei <peng.8lei@gmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
### What changes were proposed in this pull request? Quote the column name of view when `SHOW CREATE TABLE` for view. ### Why are the changes needed? follow up the [#PR](apache#35227). Keep the consistent between table and view when `SHOW CREATE TABLE`. ### Does this PR introduce _any_ user-facing change? Yes,It will change the result of `SHOW CREATE TABLE` for view. eg: ``` "STRUCT<`_c0`, `_c1`>" => "STRUCT<_c0, _c1>" ``` ### How was this patch tested? existed testcase. Closes apache#35351 from Peng-Lei/view-quote-columns. Authored-by: PengLei <peng.8lei@gmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
|
This is a user-facing breaking change. The third party libraries (esp. SQL clients) might rely on the current format. We should avoid making such a change. |
|
Hm, I think it's less likely that this breaks something because it removes the backquotes when they are unnecessary, meaning that it's still able to read and parse it back with lower versions of Spark. |
|
I think we should clearly document the display-like commands. Their output is not structured and we only expect humans to read it, not programs. |
What changes were proposed in this pull request?
Quote the column name if needed instead of always.
Why are the changes needed?
#comments
Does this PR introduce any user-facing change?
Yes,It will change the result that users get the schema
eg:
At now. for end-user. I learn about the 3 way to get schema directly
df.schema or show create table
toDDLfor StructType or StructField.How was this patch tested?
existed testcase.