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

Method buildTableFunction

src/Analyzer/QueryTreeBuilder.cpp:902–927  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

900}
901
902std::shared_ptr<TableFunctionNode> QueryTreeBuilder::buildTableFunction(const ASTPtr & table_function, const ContextPtr & context) const
903{
904 auto & table_function_expression = table_function->as<ASTFunction &>();
905
906 auto node = std::make_shared<TableFunctionNode>(table_function_expression.name);
907
908 if (table_function_expression.arguments)
909 {
910 const auto & function_arguments_list = table_function_expression.arguments->as<ASTExpressionList &>().children;
911 for (const auto & argument : function_arguments_list)
912 {
913 if (!node->getSettingsChanges().empty())
914 throw Exception(ErrorCodes::LOGICAL_ERROR, "Table function '{}' has arguments after SETTINGS",
915 table_function_expression.formatForErrorMessage());
916
917 if (argument->as<ASTSelectQuery>() || argument->as<ASTSelectWithUnionQuery>() || argument->as<ASTSelectIntersectExceptQuery>())
918 node->getArguments().getNodes().push_back(buildSelectOrUnionExpression(argument, false /*is_subquery*/, {} /*cte_name*/, nullptr /*aliases*/, context));
919 else if (const auto * ast_set = argument->as<ASTSetQuery>())
920 node->setSettingsChanges(ast_set->changes);
921 else
922 node->getArguments().getNodes().push_back(buildExpression(argument, context));
923 }
924 }
925
926 return node;
927}
928
929QueryTreeNodePtr QueryTreeBuilder::buildJoinTree(bool is_subquery, const ASTSelectQuery & select_query, const ContextPtr & context) const
930{

Callers 1

Calls 8

getSettingsChangesMethod · 0.80
getNodesMethod · 0.80
ExceptionClass · 0.50
emptyMethod · 0.45
formatForErrorMessageMethod · 0.45
push_backMethod · 0.45
getArgumentsMethod · 0.45
setSettingsChangesMethod · 0.45

Tested by

no test coverage detected