mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-19 22:22:00 +00:00
Remove code duplication
This commit is contained in:
parent
2d4b4b9008
commit
ce834b1086
@ -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 {};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user