MCPcopy Create free account
hub / github.com/ByConity/ByConity / 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(ASTPtr & table_function_ptr)
482{
483 ASTTableExpression * table_expression = getFirstTableExpression(*this);
484
485 if (!table_expression)
486 {
487 setExpression(Expression::TABLES, std::make_shared<ASTTablesInSelectQuery>());
488 auto element = std::make_shared<ASTTablesInSelectQueryElement>();
489 auto table_expr = std::make_shared<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->table_function = table_function_ptr->clone();
499 table_expression->database_and_table_name = nullptr;
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 3

rewriteSelectQueryFunction · 0.80
planReadFromStorageMethod · 0.80
interpretSubqueryFunction · 0.80

Calls 7

getFirstTableExpressionFunction · 0.70
getTableExpressionAliasFunction · 0.70
emplace_backMethod · 0.45
getMethod · 0.45
cloneMethod · 0.45
emptyMethod · 0.45
setAliasMethod · 0.45

Tested by

no test coverage detected