Try fix tests

This commit is contained in:
avogar 2022-05-20 17:48:24 +00:00
parent 78069765bb
commit 3bad21cea7
3 changed files with 7 additions and 6 deletions

View File

@ -196,7 +196,7 @@ static auto getNameRange(const ColumnsDescription::ColumnsContainer & columns, c
return std::make_pair(begin, end);
}
void ColumnsDescription::add(ColumnDescription column, const String & after_column, bool first)
void ColumnsDescription::add(ColumnDescription column, const String & after_column, bool first, bool add_subcolumns)
{
if (has(column.name))
throw Exception("Cannot add column " + column.name + ": column with this name already exists",
@ -222,7 +222,8 @@ void ColumnsDescription::add(ColumnDescription column, const String & after_colu
insert_it = range.second;
}
addSubcolumns(column.name, column.type);
if (add_subcolumns)
addSubcolumns(column.name, column.type);
columns.get<0>().insert(insert_it, std::move(column));
}

View File

@ -100,7 +100,7 @@ public:
explicit ColumnsDescription(NamesAndTypesList ordinary, NamesAndAliases aliases);
/// `after_column` can be a Nested column name;
void add(ColumnDescription column, const String & after_column = String(), bool first = false);
void add(ColumnDescription column, const String & after_column = String(), bool first = false, bool add_subcolumns = true);
/// `column_name` can be a Nested column name;
void remove(const String & column_name);

View File

@ -106,14 +106,14 @@ ColumnsDescription StorageSnapshot::getDescriptionForColumns(const Names & colum
for (const auto & name : column_names)
{
auto column = columns.tryGetColumnOrSubcolumnDescription(GetColumnsOptions::All, name);
auto object_column = object_columns.tryGetColumnOrSubcolumn(GetColumnsOptions::All, name);
auto object_column = object_columns.tryGetColumnOrSubcolumnDescription(GetColumnsOptions::All, name);
if (column && !object_column)
{
res.add(*column);
res.add(*column, "", false, false);
}
else if (object_column)
{
res.add({object_column->name, object_column->type});
res.add(*object_column, "", false, false);
}
else if (auto it = virtual_columns.find(name); it != virtual_columns.end())
{