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

Method parseArguments

src/TableFunctions/TableFunctionViewIfPermitted.cpp:71–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71void TableFunctionViewIfPermitted::parseArguments(const ASTPtr & ast_function, ContextPtr context)
72{
73 const auto * function = ast_function->as<ASTFunction>();
74 if (!function || !function->arguments || (function->arguments->children.size() != 2))
75 throw Exception(
76 ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH,
77 "Table function '{}' requires two arguments: a SELECT query and a table function",
78 getName());
79
80 const auto & arguments = function->arguments->children;
81 auto * select = arguments[0]->as<ASTSelectWithUnionQuery>();
82 if (!select)
83 throw Exception(ErrorCodes::BAD_ARGUMENTS, "Table function '{}' requires a SELECT query as its first argument", getName());
84 create.set(create.select, select->clone());
85
86 else_ast = arguments[1];
87 if (!else_ast->as<ASTFunction>())
88 throw Exception(ErrorCodes::BAD_ARGUMENTS, "Table function '{}' requires a table function as its second argument", getName());
89 else_table_function = TableFunctionFactory::instance().get(else_ast, context);
90}
91
92ColumnsDescription TableFunctionViewIfPermitted::getActualTableStructure(ContextPtr context, bool is_insert_query) const
93{

Callers

nothing calls this directly

Calls 6

ExceptionClass · 0.50
getNameFunction · 0.50
sizeMethod · 0.45
setMethod · 0.45
cloneMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected