Fix segfault and add tabs to ton of tests (desc table)

This commit is contained in:
alesapin 2018-12-25 14:33:54 +03:00
parent c91687f9d7
commit 1228645a79
13 changed files with 145 additions and 143 deletions

View File

@ -291,11 +291,12 @@ static ColumnsDeclarationAndModifiers parseColumns(const ASTExpressionList & col
auto new_columns = Nested::flattenWithMapping(columns, mapping);
for (const auto & [old_name, new_names] : mapping)
{
if (new_names.size() == 1 && old_name == new_names.back())
auto codec_it = codecs.find(old_name);
if ((new_names.size() == 1 && old_name == new_names.back()) || codec_it == codecs.end())
continue;
auto codec = codecs[old_name];
codecs.erase(old_name);
auto codec = codec_it->second;
codecs.erase(codec_it);
for (const auto & new_name : new_names)
codecs.emplace(new_name, codec);
}

View File

@ -214,17 +214,18 @@ void parseColumn(ReadBufferFromString & buf, ColumnsDescription & result, const
result.defaults.emplace(column_name, std::move(*column_default));
}
auto comment = parseComment(buf);
if (!comment.empty())
{
result.comments.emplace(column_name, std::move(comment));
}
auto codec = parseCodec(buf);
if (codec)
{
result.codecs.emplace(column_name, std::move(codec));
}
auto comment = parseComment(buf);
if (!comment.empty())
{
result.comments.emplace(column_name, std::move(comment));
}
assertChar('\n', buf);
}