made collectIdentifiersInFirstLevelOfSelectQuery static

This commit is contained in:
Nikolai Kochetov 2017-07-12 21:44:27 +03:00 committed by alexey-milovidov
parent 5ed5e8c75d
commit 1cf669cc0a
2 changed files with 18 additions and 20 deletions

View File

@ -88,6 +88,24 @@ bool StorageMerge::hasColumn(const String & column_name) const
return VirtualColumnFactory::hasColumn(column_name) || IStorage::hasColumn(column_name);
}
static Names collectIdentifiersInFirstLevelOfSelectQuery(ASTPtr ast)
{
ASTSelectQuery & select = typeid_cast<ASTSelectQuery &>(*ast);
ASTExpressionList & node = typeid_cast<ASTExpressionList &>(*select.select_expression_list);
ASTs & asts = node.children;
Names names;
for (size_t i = 0; i < asts.size(); ++i)
{
if (const ASTIdentifier * identifier = typeid_cast<const ASTIdentifier *>(&* asts[i]))
{
if (identifier->kind == ASTIdentifier::Kind::Column)
names.push_back(identifier->name);
}
}
return names;
}
BlockInputStreams StorageMerge::read(
const Names & column_names,
const ASTPtr & query,
@ -305,22 +323,4 @@ void StorageMerge::alter(const AlterCommands & params, const String & database_n
*columns, materialized_columns, alias_columns, column_defaults, {});
}
Names StorageMerge::collectIdentifiersInFirstLevelOfSelectQuery(ASTPtr ast) const
{
ASTSelectQuery & select = typeid_cast<ASTSelectQuery &>(*ast);
ASTExpressionList & node = typeid_cast<ASTExpressionList &>(*select.select_expression_list);
ASTs & asts = node.children;
Names names;
for (size_t i = 0; i < asts.size(); ++i)
{
if (const ASTIdentifier * identifier = typeid_cast<const ASTIdentifier *>(&* asts[i]))
{
if (identifier->kind == ASTIdentifier::Kind::Column)
names.push_back(identifier->name);
}
}
return names;
}
}

View File

@ -76,8 +76,6 @@ private:
StorageListWithLocks getSelectedTables() const;
Block getBlockWithVirtualColumns(const StorageListWithLocks & selected_tables) const;
Names collectIdentifiersInFirstLevelOfSelectQuery(ASTPtr ast) const;
};
}