-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Add output_format_json_escape_slashes setting - controls escaping sla… #2812
Add output_format_json_escape_slashes setting - controls escaping sla… #2812
Conversation
…shes for string outputs in JSON output format.
@@ -176,7 +176,7 @@ static void writeExtremesElement(const char * title, const Block & extremes, siz | |||
writeCString(",\n", ostr); | |||
|
|||
writeCString("\t\t\t", ostr); | |||
writeJSONString(column.name, ostr); | |||
writeJSONString(column.name, ostr, settings); |
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.
settings are propagated not in every call to writeJSONString.
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.
@alexey-milovidov please have another look, should be fine now.
Also added some basic tests.
dbms/src/IO/WriteHelpers.h
Outdated
@@ -173,7 +174,7 @@ inline void writeString(const StringRef & ref, WriteBuffer & buf) | |||
* - it is assumed that string is in UTF-8, the invalid UTF-8 is not processed | |||
* - all other non-ASCII characters remain as is | |||
*/ | |||
inline void writeJSONString(const char * begin, const char * end, WriteBuffer & buf) | |||
inline void writeJSONString(const char * begin, const char * end, WriteBuffer & buf, const FormatSettings & settings = FormatSettings()) |
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.
Try to remove default whenever possible.
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.
Not in every place the settings are available, e.g. FileChecker::save
method doesn't have settings instance available.
How should we approach this case?
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.
Just create default FormatSettings before call to this function.
If the function is called in the loop - move FormatSettings out of the loop, just in case.
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.
.
…t_format_json_escape_slashes-setting
… for output_format_json_escape_forward_slashes.
Add output_format_json_escape_slashes setting - controls escaping slashes for string outputs in JSON output format.
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en