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

Method getTableImpl

src/Databases/DatabaseFilesystem.cpp:145–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145StoragePtr DatabaseFilesystem::getTableImpl(const String & name, ContextPtr context_, bool throw_on_error) const
146{
147 /// Check if table exists in loaded tables map.
148 if (auto table = tryGetTableFromCache(name))
149 return table;
150
151 auto table_path = getTablePath(name);
152 if (!checkTableFilePath(table_path, context_, throw_on_error))
153 return {};
154
155 auto ast_function_ptr = makeASTFunction("file", make_intrusive<ASTLiteral>(table_path));
156
157 auto table_function = TableFunctionFactory::instance().get(ast_function_ptr, context_);
158 if (!table_function)
159 return nullptr;
160
161 /// TableFunctionFile throws exceptions, if table cannot be created.
162 auto table_storage = table_function->execute(ast_function_ptr, context_, name);
163 if (table_storage)
164 addTable(name, table_storage);
165
166 return table_storage;
167}
168
169StoragePtr DatabaseFilesystem::getTable(const String & name, ContextPtr context_) const
170{

Callers

nothing calls this directly

Calls 4

getTablePathFunction · 0.85
makeASTFunctionFunction · 0.50
getMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected