Remove check for clickhouse-local

From #26231 clickhouse-local uses local context for query execution.
This commit is contained in:
Azat Khuzhin 2021-11-12 22:13:10 +03:00
parent fa317e96e8
commit 68068ff71d

View File

@ -871,7 +871,7 @@ const Block * Context::tryGetLocalScalar(const String & name) const
Tables Context::getExternalTables() const
{
assert(!isGlobalContext() || getApplicationType() == ApplicationType::LOCAL);
assert(!isGlobalContext());
auto lock = getLock();
Tables res;
@ -896,7 +896,7 @@ Tables Context::getExternalTables() const
void Context::addExternalTable(const String & table_name, TemporaryTableHolder && temporary_table)
{
assert(!isGlobalContext() || getApplicationType() == ApplicationType::LOCAL);
assert(!isGlobalContext());
auto lock = getLock();
if (external_tables_mapping.end() != external_tables_mapping.find(table_name))
throw Exception("Temporary table " + backQuoteIfNeed(table_name) + " already exists.", ErrorCodes::TABLE_ALREADY_EXISTS);
@ -906,7 +906,7 @@ void Context::addExternalTable(const String & table_name, TemporaryTableHolder &
std::shared_ptr<TemporaryTableHolder> Context::removeExternalTable(const String & table_name)
{
assert(!isGlobalContext() || getApplicationType() == ApplicationType::LOCAL);
assert(!isGlobalContext());
std::shared_ptr<TemporaryTableHolder> holder;
{
auto lock = getLock();
@ -922,21 +922,21 @@ std::shared_ptr<TemporaryTableHolder> Context::removeExternalTable(const String
void Context::addScalar(const String & name, const Block & block)
{
assert(!isGlobalContext() || getApplicationType() == ApplicationType::LOCAL);
assert(!isGlobalContext());
scalars[name] = block;
}
void Context::addLocalScalar(const String & name, const Block & block)
{
assert(!isGlobalContext() || getApplicationType() == ApplicationType::LOCAL);
assert(!isGlobalContext());
local_scalars[name] = block;
}
bool Context::hasScalar(const String & name) const
{
assert(!isGlobalContext() || getApplicationType() == ApplicationType::LOCAL);
assert(!isGlobalContext());
return scalars.count(name);
}
@ -948,7 +948,7 @@ void Context::addQueryAccessInfo(
const String & projection_name,
const String & view_name)
{
assert(!isGlobalContext() || getApplicationType() == ApplicationType::LOCAL);
assert(!isGlobalContext());
std::lock_guard<std::mutex> lock(query_access_info.mutex);
query_access_info.databases.emplace(quoted_database_name);
query_access_info.tables.emplace(full_quoted_table_name);
@ -962,7 +962,7 @@ void Context::addQueryAccessInfo(
void Context::addQueryFactoriesInfo(QueryLogFactories factory_type, const String & created_object) const
{
assert(!isGlobalContext() || getApplicationType() == ApplicationType::LOCAL);
assert(!isGlobalContext());
auto lock = getLock();
switch (factory_type)
@ -2822,7 +2822,7 @@ StorageID Context::resolveStorageIDImpl(StorageID storage_id, StorageNamespace w
bool look_for_external_table = where & StorageNamespace::ResolveExternal;
/// Global context should not contain temporary tables
if (isGlobalContext() && getApplicationType() != ApplicationType::LOCAL)
if (isGlobalContext())
look_for_external_table = false;
bool in_current_database = where & StorageNamespace::ResolveCurrentDatabase;