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

Method tryGet

src/TableFunctions/TableFunctionFactory.cpp:62–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62TableFunctionPtr TableFunctionFactory::tryGet(
63 const std::string & name_param,
64 ContextPtr) const
65{
66 String name = getAliasToOrName(name_param);
67 TableFunctionPtr res;
68
69 auto it = table_functions.find(name);
70 if (table_functions.end() != it)
71 {
72 res = it->second.creator();
73 }
74 else
75 {
76 it = case_insensitive_table_functions.find(Poco::toLower(name));
77 if (case_insensitive_table_functions.end() != it)
78 res = it->second.creator();
79 }
80
81 if (!res)
82 return nullptr;
83
84 if (CurrentThread::isInitialized())
85 {
86 auto query_context = CurrentThread::get().tryGetQueryContext();
87 if (query_context && query_context->getSettingsRef()[Setting::log_queries])
88 query_context->addQueryFactoriesInfo(Context::QueryLogFactories::TableFunction, name);
89 }
90
91 return res;
92}
93
94bool TableFunctionFactory::isTableFunctionName(const std::string & name) const
95{

Callers 1

parseArgumentsMethod · 0.45

Calls 6

addQueryFactoriesInfoMethod · 0.80
toLowerFunction · 0.50
getFunction · 0.50
findMethod · 0.45
endMethod · 0.45
tryGetQueryContextMethod · 0.45

Tested by

no test coverage detected