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

Method execute

src/TableFunctions/ITableFunction.cpp:55–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55StoragePtr ITableFunction::execute(const ASTPtr & ast_function, ContextPtr context, const std::string & table_name,
56 ColumnsDescription cached_columns, bool use_global_context, bool is_insert_query) const
57{
58 ProfileEvents::increment(ProfileEvents::TableFunctionExecute);
59
60 checkSourceAccess(context, is_insert_query);
61
62 auto table_function_properties = TableFunctionFactory::instance().tryGetProperties(getName());
63 if (is_insert_query || !(table_function_properties && table_function_properties->allow_readonly))
64 context->checkAccess(AccessType::CREATE_TEMPORARY_TABLE);
65
66 auto context_to_use = use_global_context ? context->getGlobalContext() : context;
67
68 if (cached_columns.empty())
69 return executeImpl(ast_function, context, table_name, std::move(cached_columns), is_insert_query);
70
71 if (hasStaticStructure() && cached_columns == getActualTableStructure(context, is_insert_query))
72 return executeImpl(ast_function, context_to_use, table_name, std::move(cached_columns), is_insert_query);
73
74 auto this_table_function = shared_from_this();
75 auto get_storage = [=]() -> StoragePtr
76 {
77 return this_table_function->executeImpl(ast_function, context_to_use, table_name, cached_columns, is_insert_query);
78 };
79
80 /// It will request actual table structure and create underlying storage lazily
81 return std::make_shared<StorageTableFunctionProxy>(StorageID(getDatabaseName(), table_name), std::move(get_storage),
82 std::move(cached_columns), needStructureConversion());
83}
84
85String ITableFunction::getFunctionURINormalized() const
86{

Callers 3

executeImplMethod · 0.45
executeImplMethod · 0.45
executeImplMethod · 0.45

Calls 9

incrementFunction · 0.50
getNameFunction · 0.50
executeImplFunction · 0.50
StorageIDClass · 0.50
tryGetPropertiesMethod · 0.45
checkAccessMethod · 0.45
getGlobalContextMethod · 0.45
emptyMethod · 0.45
executeImplMethod · 0.45

Tested by

no test coverage detected