| 97 | } |
| 98 | |
| 99 | ColumnsDescription TableFunctionLoop::getActualTableStructure(ContextPtr context, bool is_insert_query) const |
| 100 | { |
| 101 | if (inner_table_function_ast) |
| 102 | { |
| 103 | auto inner_table_function = TableFunctionFactory::instance().get(inner_table_function_ast, context); |
| 104 | return inner_table_function->getActualTableStructure(context, is_insert_query); |
| 105 | } |
| 106 | |
| 107 | String database_name = loop_database_name; |
| 108 | if (database_name.empty()) |
| 109 | database_name = context->getCurrentDatabase(); |
| 110 | |
| 111 | auto database = DatabaseCatalog::instance().getDatabase(database_name); |
| 112 | auto storage = database->tryGetTable(loop_table_name, context); |
| 113 | if (!storage) |
| 114 | throw Exception(ErrorCodes::UNKNOWN_TABLE, "Table '{}' not found in database '{}'", loop_table_name, database_name); |
| 115 | |
| 116 | auto metadata_snapshot = storage->getInMemoryMetadataPtr(context, false); |
| 117 | return metadata_snapshot->getColumns(); |
| 118 | } |
| 119 | |
| 120 | StoragePtr TableFunctionLoop::executeImpl( |
| 121 | const ASTPtr & /*ast_function*/, |
nothing calls this directly
no test coverage detected