MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / addTableFunction

Method addTableFunction

src/Parsers/ASTSelectQuery.cpp:481–503  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

479
480
481void ASTSelectQuery::addTableFunction(const ASTPtr & table_function_ptr)
482{
483 ASTTableExpression * table_expression = getFirstTableExpression(*this);
484
485 if (!table_expression)
486 {
487 setExpression(Expression::TABLES, make_intrusive<ASTTablesInSelectQuery>());
488 auto element = make_intrusive<ASTTablesInSelectQueryElement>();
489 auto table_expr = make_intrusive<ASTTableExpression>();
490 element->table_expression = table_expr;
491 element->children.emplace_back(table_expr);
492 tables()->children.emplace_back(element);
493 table_expression = table_expr.get();
494 }
495
496 String table_alias = getTableExpressionAlias(table_expression);
497 /// Maybe need to modify the alias, so we should clone new table_function node
498 table_expression->setOrReplace(table_expression->table_function, table_function_ptr->clone());
499 table_expression->reset(table_expression->database_and_table_name);
500
501 if (table_alias.empty())
502 table_expression->table_function->setAlias(table_alias);
503}
504
505void ASTSelectQuery::setExpression(Expression expr, ASTPtr && ast)
506{

Callers 4

buildSelectQueryPlanFunction · 0.80
interpretSubqueryFunction · 0.80
rewriteSelectQueryFunction · 0.80

Calls 9

getTableExpressionAliasFunction · 0.85
setOrReplaceMethod · 0.80
getFirstTableExpressionFunction · 0.70
emplace_backMethod · 0.45
getMethod · 0.45
cloneMethod · 0.45
resetMethod · 0.45
emptyMethod · 0.45
setAliasMethod · 0.45

Tested by

no test coverage detected