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/JSONObjectEachRowRowOutputFormat.cpp | |
parent | f82bfd2a08a51c4815a4cde64974f819ed4f7128 (diff) | |
download | ydb-fa9347ea5cf4447897b525032be9a711cc3dc583.tar.gz |
Intermediate changes
Diffstat (limited to 'contrib/clickhouse/src/Processors/Formats/Impl/JSONObjectEachRowRowOutputFormat.cpp')
-rw-r--r-- | contrib/clickhouse/src/Processors/Formats/Impl/JSONObjectEachRowRowOutputFormat.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/contrib/clickhouse/src/Processors/Formats/Impl/JSONObjectEachRowRowOutputFormat.cpp b/contrib/clickhouse/src/Processors/Formats/Impl/JSONObjectEachRowRowOutputFormat.cpp index a02199d607..5d8e74309e 100644 --- a/contrib/clickhouse/src/Processors/Formats/Impl/JSONObjectEachRowRowOutputFormat.cpp +++ b/contrib/clickhouse/src/Processors/Formats/Impl/JSONObjectEachRowRowOutputFormat.cpp @@ -26,9 +26,10 @@ void JSONObjectEachRowRowOutputFormat::write(const Columns & columns, size_t row if (field_index_for_object_name) object_name = columns[*field_index_for_object_name]->getDataAt(row).toString(); else - object_name = "row_" + std::to_string(row + 1); + object_name = "row_" + std::to_string(getRowsReadBefore() + rows + 1); - IRowOutputFormat::write(columns, row); + ++rows; + RowOutputFormatWithExceptionHandlerAdaptor::write(columns, row); } void JSONObjectEachRowRowOutputFormat::writeFieldDelimiter() @@ -62,6 +63,13 @@ void JSONObjectEachRowRowOutputFormat::writeRowBetweenDelimiter() void JSONObjectEachRowRowOutputFormat::writeSuffix() { + if (!exception_message.empty()) + { + if (haveWrittenData()) + writeRowBetweenDelimiter(); + JSONUtils::writeException(exception_message, *ostr, settings, 1); + } + JSONUtils::writeObjectEnd(*ostr); writeChar('\n', *ostr); } |