Remove code duplication

This commit is contained in:
avogar 2022-05-16 14:40:25 +00:00
parent 2d4b4b9008
commit ce834b1086

View File

@ -543,16 +543,9 @@ Names ColumnsDescription::getNamesOfPhysical() const
std::optional<NameAndTypePair> ColumnsDescription::tryGetColumn(const GetColumnsOptions & options, const String & column_name) const
{
auto it = columns.get<1>().find(column_name);
if (it != columns.get<1>().end() && (defaultKindToGetKind(it->default_desc.kind) & options.kind))
return NameAndTypePair(it->name, it->type);
if (options.with_subcolumns)
{
auto jt = subcolumns.get<0>().find(column_name);
if (jt != subcolumns.get<0>().end())
return *jt;
}
auto column_description = tryGetColumnDescription(options, column_name);
if (column_description)
return NameAndTypePair{column_description->name, column_description->type};
return {};
}