| 143 | } |
| 144 | |
| 145 | StoragePtr 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 | |
| 169 | StoragePtr DatabaseFilesystem::getTable(const String & name, ContextPtr context_) const |
| 170 | { |
nothing calls this directly
no test coverage detected