diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2023-12-09 10:11:16 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2023-12-09 10:33:35 +0300 |
commit | fa9347ea5cf4447897b525032be9a711cc3dc583 (patch) | |
tree | 4f3d4f493e4cfb43a3c8b5f7e279621c41e0e978 /contrib/clickhouse/src/Formats | |
parent | f82bfd2a08a51c4815a4cde64974f819ed4f7128 (diff) | |
download | ydb-fa9347ea5cf4447897b525032be9a711cc3dc583.tar.gz |
Intermediate changes
Diffstat (limited to 'contrib/clickhouse/src/Formats')
-rw-r--r-- | contrib/clickhouse/src/Formats/FormatFactory.cpp | 7 | ||||
-rw-r--r-- | contrib/clickhouse/src/Formats/FormatSettings.h | 6 | ||||
-rw-r--r-- | contrib/clickhouse/src/Formats/JSONUtils.cpp | 6 | ||||
-rw-r--r-- | contrib/clickhouse/src/Formats/JSONUtils.h | 2 |
4 files changed, 20 insertions, 1 deletions
diff --git a/contrib/clickhouse/src/Formats/FormatFactory.cpp b/contrib/clickhouse/src/Formats/FormatFactory.cpp index c349ebd94e..d7348527b9 100644 --- a/contrib/clickhouse/src/Formats/FormatFactory.cpp +++ b/contrib/clickhouse/src/Formats/FormatFactory.cpp @@ -1,7 +1,6 @@ #include <Formats/FormatFactory.h> #include <algorithm> -#include <Core/Settings.h> #include <Formats/FormatSettings.h> #include <Interpreters/Context.h> #include <Interpreters/ProcessList.h> @@ -229,6 +228,12 @@ FormatSettings getFormatSettings(ContextPtr context, const Settings & settings) context->getRemoteHostFilter().checkURL(avro_schema_registry_url); } + if (context->getClientInfo().interface == ClientInfo::Interface::HTTP && context->getSettingsRef().http_write_exception_in_output_format.value) + { + format_settings.json.valid_output_on_exception = true; + format_settings.xml.valid_output_on_exception = true; + } + return format_settings; } diff --git a/contrib/clickhouse/src/Formats/FormatSettings.h b/contrib/clickhouse/src/Formats/FormatSettings.h index 0c760f9151..1de2f1da5e 100644 --- a/contrib/clickhouse/src/Formats/FormatSettings.h +++ b/contrib/clickhouse/src/Formats/FormatSettings.h @@ -198,6 +198,7 @@ struct FormatSettings bool validate_types_from_metadata = true; bool validate_utf8 = false; bool allow_object_type = false; + bool valid_output_on_exception = false; bool compact_allow_variable_number_of_columns = false; } json; @@ -405,6 +406,11 @@ struct FormatSettings { bool allow_types_conversion = true; } native; + + struct + { + bool valid_output_on_exception = false; + } xml; }; } diff --git a/contrib/clickhouse/src/Formats/JSONUtils.cpp b/contrib/clickhouse/src/Formats/JSONUtils.cpp index 6fbda86915..240f1dba33 100644 --- a/contrib/clickhouse/src/Formats/JSONUtils.cpp +++ b/contrib/clickhouse/src/Formats/JSONUtils.cpp @@ -531,6 +531,12 @@ namespace JSONUtils } } + void writeException(const String & exception_message, WriteBuffer & out, const FormatSettings & settings, size_t indent) + { + writeTitle("exception", out, indent, " "); + writeJSONString(exception_message, out, settings); + } + Strings makeNamesValidJSONStrings(const Strings & names, const FormatSettings & settings, bool validate_utf8) { Strings result; diff --git a/contrib/clickhouse/src/Formats/JSONUtils.h b/contrib/clickhouse/src/Formats/JSONUtils.h index bd56eb646c..b2bd29bcd0 100644 --- a/contrib/clickhouse/src/Formats/JSONUtils.h +++ b/contrib/clickhouse/src/Formats/JSONUtils.h @@ -108,6 +108,8 @@ namespace JSONUtils bool write_statistics, WriteBuffer & out); + void writeException(const String & exception_message, WriteBuffer & out, const FormatSettings & settings, size_t indent = 0); + void skipColon(ReadBuffer & in); void skipComma(ReadBuffer & in); |