mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
remove another method from Context
This commit is contained in:
parent
d5e79153c2
commit
29a993a66f
@ -844,19 +844,6 @@ StoragePtr Context::getViewSource()
|
||||
return view_source;
|
||||
}
|
||||
|
||||
ASTPtr Context::getCreateExternalTableQuery(const String & table_name) const
|
||||
{
|
||||
StorageID external_id = StorageID::createEmpty();
|
||||
{
|
||||
auto lock = getLock();
|
||||
auto it = external_tables_mapping.find(table_name);
|
||||
if (external_tables_mapping.end() == it)
|
||||
throw Exception("Temporary table " + backQuoteIfNeed(table_name) + " doesn't exist", ErrorCodes::UNKNOWN_TABLE);
|
||||
external_id = it->second->getGlobalTableID();
|
||||
}
|
||||
return DatabaseCatalog::instance().getDatabaseForTemporaryTables()->getCreateTableQuery(*this, external_id.table_name);
|
||||
}
|
||||
|
||||
Settings Context::getSettings() const
|
||||
{
|
||||
return settings;
|
||||
|
@ -175,8 +175,11 @@ private:
|
||||
using TemporaryTablesMapping = std::map<String, std::shared_ptr<TemporaryTableHolder>>;
|
||||
TemporaryTablesMapping external_tables_mapping;
|
||||
Scalars scalars;
|
||||
|
||||
//TODO maybe replace with temporary tables?
|
||||
StoragePtr view_source; /// Temporary StorageValues used to generate alias columns for materialized views
|
||||
Tables table_function_results; /// Temporary tables obtained by execution of table functions. Keyed by AST tree id.
|
||||
|
||||
Context * query_context = nullptr;
|
||||
Context * session_context = nullptr; /// Session context or nullptr. Could be equal to this.
|
||||
Context * global_context = nullptr; /// Global context. Could be equal to this.
|
||||
@ -385,9 +388,6 @@ public:
|
||||
|
||||
std::optional<UInt16> getTCPPortSecure() const;
|
||||
|
||||
/// Get query for the CREATE table.
|
||||
ASTPtr getCreateExternalTableQuery(const String & table_name) const;
|
||||
|
||||
std::shared_ptr<Context> acquireSession(const String & session_id, std::chrono::steady_clock::duration timeout, bool session_check) const;
|
||||
void releaseSession(const String & session_id, std::chrono::steady_clock::duration timeout);
|
||||
|
||||
@ -595,8 +595,6 @@ private:
|
||||
|
||||
EmbeddedDictionaries & getEmbeddedDictionariesImpl(bool throw_on_error) const;
|
||||
|
||||
StoragePtr getTableImpl(const StorageID & table_id, std::optional<Exception> * exception) const;
|
||||
|
||||
SessionKey getSessionKey(const String & session_id) const;
|
||||
|
||||
/// Session will be closed after specified timeout.
|
||||
|
@ -47,18 +47,17 @@ BlockInputStreamPtr InterpreterShowCreateQuery::executeImpl()
|
||||
ASTQueryWithTableAndOutput * show_query;
|
||||
if ((show_query = query_ptr->as<ASTShowCreateTableQuery>()))
|
||||
{
|
||||
if (show_query->temporary)
|
||||
create_query = context.getCreateExternalTableQuery(show_query->table);
|
||||
else
|
||||
{
|
||||
context.checkAccess(AccessType::SHOW, show_query->database, show_query->table);
|
||||
create_query = DatabaseCatalog::instance().getDatabase(show_query->database, context)->getCreateTableQuery(context, show_query->table);
|
||||
}
|
||||
StorageID table_id{show_query->database, show_query->table};
|
||||
auto resolve_table_type = show_query->temporary ? Context::ResolveExternal : Context::ResolveOrdinary;
|
||||
table_id = context.resolveStorageID(table_id, resolve_table_type);
|
||||
context.checkAccess(AccessType::SHOW, table_id.database_name, table_id.table_name);
|
||||
create_query = DatabaseCatalog::instance().getDatabase(table_id.database_name)->getCreateTableQuery(context, table_id.table_name);
|
||||
}
|
||||
else if ((show_query = query_ptr->as<ASTShowCreateDatabaseQuery>()))
|
||||
{
|
||||
if (show_query->temporary)
|
||||
throw Exception("Temporary databases are not possible.", ErrorCodes::SYNTAX_ERROR);
|
||||
show_query->database = context.resolveDatabase(show_query->database);
|
||||
context.checkAccess(AccessType::SHOW, show_query->database);
|
||||
create_query = DatabaseCatalog::instance().getDatabase(show_query->database)->getCreateDatabaseQuery(context);
|
||||
}
|
||||
@ -66,8 +65,9 @@ BlockInputStreamPtr InterpreterShowCreateQuery::executeImpl()
|
||||
{
|
||||
if (show_query->temporary)
|
||||
throw Exception("Temporary dictionaries are not possible.", ErrorCodes::SYNTAX_ERROR);
|
||||
show_query->database = context.resolveDatabase(show_query->database);
|
||||
context.checkAccess(AccessType::SHOW, show_query->database, show_query->table);
|
||||
create_query = DatabaseCatalog::instance().getDatabase(show_query->database, context)->getCreateDictionaryQuery(context, show_query->table);
|
||||
create_query = DatabaseCatalog::instance().getDatabase(show_query->database)->getCreateDictionaryQuery(context, show_query->table);
|
||||
}
|
||||
|
||||
if (!create_query && show_query && show_query->temporary)
|
||||
|
@ -396,10 +396,10 @@ StorageMerge::StorageListWithLocks StorageMerge::getSelectedTables(const ASTPtr
|
||||
}
|
||||
|
||||
|
||||
DatabaseTablesIteratorPtr StorageMerge::getDatabaseIterator(const Context & context) const
|
||||
DatabaseTablesIteratorPtr StorageMerge::getDatabaseIterator() const
|
||||
{
|
||||
checkStackSize();
|
||||
auto database = DatabaseCatalog::instance().getDatabase(source_database, context);
|
||||
auto database = DatabaseCatalog::instance().getDatabase(source_database);
|
||||
auto table_name_match = [this](const String & table_name_) { return table_name_regexp.match(table_name_); };
|
||||
return database->getTablesIterator(global_context, table_name_match);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user