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

Method getActualTableStructure

src/TableFunctions/TableFunctionLoop.cpp:99–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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*/,

Callers

nothing calls this directly

Calls 8

getCurrentDatabaseMethod · 0.80
ExceptionClass · 0.50
getMethod · 0.45
emptyMethod · 0.45
getDatabaseMethod · 0.45
tryGetTableMethod · 0.45
getColumnsMethod · 0.45

Tested by

no test coverage detected