fix TTL info serialization

This commit is contained in:
Anton Popov 2021-01-12 17:04:03 +03:00
parent 61d6a323dd
commit 58b9ef5a10

View File

@ -143,8 +143,8 @@ void MergeTreeDataPartTTLInfos::write(WriteBuffer & out) const
if (!is_first) if (!is_first)
writeString(",", out); writeString(",", out);
writeString(type, out); writeDoubleQuotedString(type, out);
writeString(R"(:[)", out); writeString(":[", out);
for (auto it = infos.begin(); it != infos.end(); ++it) for (auto it = infos.begin(); it != infos.end(); ++it)
{ {
if (it != infos.begin()) if (it != infos.begin())
@ -162,15 +162,25 @@ void MergeTreeDataPartTTLInfos::write(WriteBuffer & out) const
}; };
bool is_first = columns_ttl.empty() && !table_ttl.min; bool is_first = columns_ttl.empty() && !table_ttl.min;
if (!moves_ttl.empty())
{
write_infos(moves_ttl, "moves", is_first); write_infos(moves_ttl, "moves", is_first);
is_first = false;
}
is_first &= moves_ttl.empty(); if (!recompression_ttl.empty())
{
write_infos(recompression_ttl, "recompression", is_first); write_infos(recompression_ttl, "recompression", is_first);
is_first = false;
}
is_first &= recompression_ttl.empty(); if (!group_by_ttl.empty())
{
write_infos(group_by_ttl, "group_by", is_first); write_infos(group_by_ttl, "group_by", is_first);
is_first = false;
}
is_first &= group_by_ttl.empty(); if (!rows_where_ttl.empty())
write_infos(rows_where_ttl, "rows_where", is_first); write_infos(rows_where_ttl, "rows_where", is_first);
writeString("}", out); writeString("}", out);