| 900 | } |
| 901 | |
| 902 | std::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 | |
| 929 | QueryTreeNodePtr QueryTreeBuilder::buildJoinTree(bool is_subquery, const ASTSelectQuery & select_query, const ContextPtr & context) const |
| 930 | { |
no test coverage detected