This commit is contained in:
Pavel Kruglov 2024-11-20 15:25:05 -08:00 committed by GitHub
commit f3c4fedd35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 2 deletions

View File

@ -762,8 +762,12 @@ void SerializationDynamic::serializeTextJSON(const IColumn & column, size_t row_
void SerializationDynamic::serializeTextJSONPretty(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings, size_t indent) const void SerializationDynamic::serializeTextJSONPretty(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings, size_t indent) const
{ {
const auto & dynamic_column = assert_cast<const ColumnDynamic &>(column); auto nested_serialize = [&settings, indent](const ISerialization & serialization, const IColumn & col, size_t row, WriteBuffer & buf)
dynamic_column.getVariantInfo().variant_type->getDefaultSerialization()->serializeTextJSONPretty(dynamic_column.getVariantColumn(), row_num, ostr, settings, indent); {
serialization.serializeTextJSONPretty(col, row, buf, settings, indent);
};
serializeTextImpl(column, row_num, ostr, settings, nested_serialize);
} }
void SerializationDynamic::deserializeTextJSON(IColumn & column, ReadBuffer & istr, const FormatSettings & settings) const void SerializationDynamic::deserializeTextJSON(IColumn & column, ReadBuffer & istr, const FormatSettings & settings) const

View File

@ -0,0 +1,6 @@
{
"d": "Hello"
}
{
"d": "Hello"
}

View File

@ -0,0 +1,6 @@
set allow_experimental_dynamic_type = 1;
select 'Hello'::Dynamic(max_types=1) as d format PrettyJSONEachRow;
select 'Hello'::Dynamic(max_types=0) as d format PrettyJSONEachRow;