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/Processors/Formats/Impl/JSONCompactEachRowRowOutputFormat.cpp | |
parent | f82bfd2a08a51c4815a4cde64974f819ed4f7128 (diff) | |
download | ydb-fa9347ea5cf4447897b525032be9a711cc3dc583.tar.gz |
Intermediate changes
Diffstat (limited to 'contrib/clickhouse/src/Processors/Formats/Impl/JSONCompactEachRowRowOutputFormat.cpp')
-rw-r--r-- | contrib/clickhouse/src/Processors/Formats/Impl/JSONCompactEachRowRowOutputFormat.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/contrib/clickhouse/src/Processors/Formats/Impl/JSONCompactEachRowRowOutputFormat.cpp b/contrib/clickhouse/src/Processors/Formats/Impl/JSONCompactEachRowRowOutputFormat.cpp index 0cafc05346..530d09d5c8 100644 --- a/contrib/clickhouse/src/Processors/Formats/Impl/JSONCompactEachRowRowOutputFormat.cpp +++ b/contrib/clickhouse/src/Processors/Formats/Impl/JSONCompactEachRowRowOutputFormat.cpp @@ -15,12 +15,13 @@ JSONCompactEachRowRowOutputFormat::JSONCompactEachRowRowOutputFormat(WriteBuffer bool with_names_, bool with_types_, bool yield_strings_) - : RowOutputFormatWithUTF8ValidationAdaptor(settings_.json.validate_utf8, header_, out_) + : RowOutputFormatWithExceptionHandlerAdaptor<RowOutputFormatWithUTF8ValidationAdaptor, bool>(header_, out_, settings_.json.valid_output_on_exception, settings_.json.validate_utf8) , settings(settings_) , with_names(with_names_) , with_types(with_types_) , yield_strings(yield_strings_) { + ostr = RowOutputFormatWithExceptionHandlerAdaptor::getWriteBufferPtr(); } @@ -102,6 +103,25 @@ void JSONCompactEachRowRowOutputFormat::consumeTotals(DB::Chunk chunk) IRowOutputFormat::consumeTotals(std::move(chunk)); } +void JSONCompactEachRowRowOutputFormat::writeSuffix() +{ + if (!exception_message.empty()) + { + if (haveWrittenData()) + writeRowBetweenDelimiter(); + + writeRowStartDelimiter(); + writeJSONString(exception_message, *ostr, settings); + writeRowEndDelimiter(); + } +} + +void JSONCompactEachRowRowOutputFormat::resetFormatterImpl() +{ + RowOutputFormatWithExceptionHandlerAdaptor::resetFormatterImpl(); + ostr = RowOutputFormatWithExceptionHandlerAdaptor::getWriteBufferPtr(); +} + void registerOutputFormatJSONCompactEachRow(FormatFactory & factory) { for (bool yield_strings : {false, true}) |