-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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
[SPARK-23058][SQL] Show non printable field delim as unicode #20248
Conversation
@@ -1023,7 +1023,12 @@ case class ShowCreateTableCommand(table: TableIdentifier) extends RunnableComman | |||
|
|||
val serdeProps = metadata.storage.properties.map { | |||
case (key, value) => | |||
s"'${escapeSingleQuotedString(key)}' = '${escapeSingleQuotedString(value)}'" | |||
val escapedValue = if (value.length == 1 && (value.head < 32 || value.head > 126)) { |
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 think you want Character.isISOControl
here. But this is a bit hacky as you're here hard-coding assumptions about the encoding. Why print non-printable chars, and why octal? what goes wrong?
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 need to copy an external table to another environment, but lost the create table statement. So I want to get this create table statement by show create table ...
, but it can't show non printable field delim.
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, so when the same properties are specified, they can be specified as an octal escape sequence. That makes sense to render it back that way. I'd still use isISOControl
for better generality.
Test build #86040 has finished for PR 20248 at commit
|
Test build #86081 has finished for PR 20248 at commit
|
retest this please |
Test build #86088 has finished for PR 20248 at commit
|
retest this please |
Test build #86095 has finished for PR 20248 at commit
|
What changes were proposed in this pull request?
Create a table with non printable delim like below:
When
show create table t1
. Before this PR::After this PR:
This PR show non printable field delim as unicode when
show create table ...
and we can recreate table use this message now.How was this patch tested?
unit tests