aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Processors/Formats/Impl/XMLRowOutputFormat.cpp
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2023-12-09 10:11:16 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2023-12-09 10:33:35 +0300
commitfa9347ea5cf4447897b525032be9a711cc3dc583 (patch)
tree4f3d4f493e4cfb43a3c8b5f7e279621c41e0e978 /contrib/clickhouse/src/Processors/Formats/Impl/XMLRowOutputFormat.cpp
parentf82bfd2a08a51c4815a4cde64974f819ed4f7128 (diff)
downloadydb-fa9347ea5cf4447897b525032be9a711cc3dc583.tar.gz
Intermediate changes
Diffstat (limited to 'contrib/clickhouse/src/Processors/Formats/Impl/XMLRowOutputFormat.cpp')
-rw-r--r--contrib/clickhouse/src/Processors/Formats/Impl/XMLRowOutputFormat.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/contrib/clickhouse/src/Processors/Formats/Impl/XMLRowOutputFormat.cpp b/contrib/clickhouse/src/Processors/Formats/Impl/XMLRowOutputFormat.cpp
index 1d6fb62275..52c161c320 100644
--- a/contrib/clickhouse/src/Processors/Formats/Impl/XMLRowOutputFormat.cpp
+++ b/contrib/clickhouse/src/Processors/Formats/Impl/XMLRowOutputFormat.cpp
@@ -8,8 +8,9 @@ namespace DB
{
XMLRowOutputFormat::XMLRowOutputFormat(WriteBuffer & out_, const Block & header_, const FormatSettings & format_settings_)
- : RowOutputFormatWithUTF8ValidationAdaptor(true, header_, out_), fields(header_.getNamesAndTypes()), format_settings(format_settings_)
+ : RowOutputFormatWithExceptionHandlerAdaptor<RowOutputFormatWithUTF8ValidationAdaptor, bool>(header_, out_, format_settings_.xml.valid_output_on_exception, true), fields(header_.getNamesAndTypes()), format_settings(format_settings_)
{
+ ostr = RowOutputFormatWithExceptionHandlerAdaptor::getWriteBufferPtr();
const auto & sample = getPort(PortKind::Main).getHeader();
field_tag_names.resize(sample.columns());
@@ -191,7 +192,9 @@ void XMLRowOutputFormat::finalizeImpl()
writeRowsBeforeLimitAtLeast();
- if (format_settings.write_statistics)
+ if (!exception_message.empty())
+ writeException();
+ else if (format_settings.write_statistics)
writeStatistics();
writeCString("</result>\n", *ostr);
@@ -200,7 +203,8 @@ void XMLRowOutputFormat::finalizeImpl()
void XMLRowOutputFormat::resetFormatterImpl()
{
- RowOutputFormatWithUTF8ValidationAdaptor::resetFormatterImpl();
+ RowOutputFormatWithExceptionHandlerAdaptor::resetFormatterImpl();
+ ostr = RowOutputFormatWithExceptionHandlerAdaptor::getWriteBufferPtr();
row_count = 0;
statistics = Statistics();
}
@@ -230,6 +234,12 @@ void XMLRowOutputFormat::writeStatistics()
writeCString("\t</statistics>\n", *ostr);
}
+void XMLRowOutputFormat::writeException()
+{
+ writeCString("\t<exception>", *ostr);
+ writeXMLStringForTextElement(exception_message, *ostr);
+ writeCString("</exception>\n", *ostr);
+}
void registerOutputFormatXML(FormatFactory & factory)
{