mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
fix table functions & RequiredSourceColumnsVisitor
This commit is contained in:
parent
8bff0d74c0
commit
14faa95c83
@ -88,7 +88,6 @@ void RequiredSourceColumnsMatcher::visit(ASTPtr & ast, Data & data)
|
|||||||
|
|
||||||
if (auto * t = typeid_cast<ASTTableExpression *>(ast.get()))
|
if (auto * t = typeid_cast<ASTTableExpression *>(ast.get()))
|
||||||
{
|
{
|
||||||
//data.addTableAliasIfAny(*ast); alias is attached to child
|
|
||||||
visit(*t, ast, data);
|
visit(*t, ast, data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -182,27 +181,17 @@ void RequiredSourceColumnsMatcher::visit(ASTTablesInSelectQueryElement & node, c
|
|||||||
data.tables.emplace_back(ColumnNamesContext::JoinedTable{expr, join});
|
data.tables.emplace_back(ColumnNamesContext::JoinedTable{expr, join});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// ASTIdentifiers here are tables. Do not visit them as generic ones.
|
||||||
void RequiredSourceColumnsMatcher::visit(ASTTableExpression & node, const ASTPtr &, Data & data)
|
void RequiredSourceColumnsMatcher::visit(ASTTableExpression & node, const ASTPtr &, Data & data)
|
||||||
{
|
{
|
||||||
/// ASTIdentifiers here are tables. Do not visit them as generic ones.
|
|
||||||
if (node.database_and_table_name)
|
if (node.database_and_table_name)
|
||||||
data.addTableAliasIfAny(*node.database_and_table_name);
|
data.addTableAliasIfAny(*node.database_and_table_name);
|
||||||
|
|
||||||
std::vector<ASTPtr *> out;
|
|
||||||
if (node.table_function)
|
if (node.table_function)
|
||||||
{
|
|
||||||
data.addTableAliasIfAny(*node.table_function);
|
data.addTableAliasIfAny(*node.table_function);
|
||||||
out.push_back(&node.table_function);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.subquery)
|
if (node.subquery)
|
||||||
{
|
|
||||||
data.addTableAliasIfAny(*node.subquery);
|
data.addTableAliasIfAny(*node.subquery);
|
||||||
out.push_back(&node.subquery);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (ASTPtr * add_node : out)
|
|
||||||
Visitor(data).visit(*add_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RequiredSourceColumnsMatcher::visit(const ASTArrayJoin & node, const ASTPtr &, Data & data)
|
void RequiredSourceColumnsMatcher::visit(const ASTArrayJoin & node, const ASTPtr &, Data & data)
|
||||||
|
Loading…
Reference in New Issue
Block a user