From 434a9da33eaa0593cfd83ebd2550c28e2cb565c7 Mon Sep 17 00:00:00 2001 From: hehechen Date: Tue, 24 May 2022 11:13:42 +0800 Subject: [PATCH] fix clang tidy Signed-off-by: hehechen --- dbms/src/Interpreters/Context.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/dbms/src/Interpreters/Context.cpp b/dbms/src/Interpreters/Context.cpp index 1c74b5f402e..5d967b388d0 100644 --- a/dbms/src/Interpreters/Context.cpp +++ b/dbms/src/Interpreters/Context.cpp @@ -162,7 +162,7 @@ struct ContextShared PathCapacityMetricsPtr path_capacity_ptr; /// Path capacity metrics FileProviderPtr file_provider; /// File provider. IORateLimiter io_rate_limiter; - PageStorageRunMode storage_run_mode; + PageStorageRunMode storage_run_mode = PageStorageRunMode::ONLY_V3; DM::GlobalStoragePoolPtr global_storage_pool; /// Named sessions. The user could specify session identifier to reuse settings and temporary tables in subsequent requests. @@ -714,7 +714,7 @@ Dependencies Context::getDependencies(const String & database_name, const String checkDatabaseAccessRightsImpl(db); } - ViewDependencies::const_iterator iter = shared->view_dependencies.find(DatabaseAndTableName(db, table_name)); + auto iter = shared->view_dependencies.find(DatabaseAndTableName(db, table_name)); if (iter == shared->view_dependencies.end()) return {}; @@ -728,7 +728,7 @@ bool Context::isTableExist(const String & database_name, const String & table_na String db = resolveDatabase(database_name, current_database); checkDatabaseAccessRightsImpl(db); - Databases::const_iterator it = shared->databases.find(db); + auto it = shared->databases.find(db); return shared->databases.end() != it && it->second->isTableExist(*this, table_name); } @@ -754,7 +754,7 @@ void Context::assertTableExists(const String & database_name, const String & tab String db = resolveDatabase(database_name, current_database); checkDatabaseAccessRightsImpl(db); - Databases::const_iterator it = shared->databases.find(db); + auto it = shared->databases.find(db); if (shared->databases.end() == it) throw Exception(fmt::format("Database {} doesn't exist", backQuoteIfNeed(db)), ErrorCodes::UNKNOWN_DATABASE); @@ -771,7 +771,7 @@ void Context::assertTableDoesntExist(const String & database_name, const String if (check_database_access_rights) checkDatabaseAccessRightsImpl(db); - Databases::const_iterator it = shared->databases.find(db); + auto it = shared->databases.find(db); if (shared->databases.end() != it && it->second->isTableExist(*this, table_name)) throw Exception(fmt::format("Table {}.{} already exists.", backQuoteIfNeed(db), backQuoteIfNeed(table_name)), ErrorCodes::TABLE_ALREADY_EXISTS); } @@ -826,7 +826,7 @@ Tables Context::getExternalTables() const StoragePtr Context::tryGetExternalTable(const String & table_name) const { - TableAndCreateASTs::const_iterator jt = external_tables.find(table_name); + auto jt = external_tables.find(table_name); if (external_tables.end() == jt) return StoragePtr(); @@ -864,7 +864,7 @@ StoragePtr Context::getTableImpl(const String & database_name, const String & ta String db = resolveDatabase(database_name, current_database); checkDatabaseAccessRightsImpl(db); - Databases::const_iterator it = shared->databases.find(db); + auto it = shared->databases.find(db); if (shared->databases.end() == it) { if (exception) @@ -894,7 +894,7 @@ void Context::addExternalTable(const String & table_name, const StoragePtr & sto StoragePtr Context::tryRemoveExternalTable(const String & table_name) { - TableAndCreateASTs::const_iterator it = external_tables.find(table_name); + auto it = external_tables.find(table_name); if (external_tables.end() == it) return StoragePtr(); @@ -954,7 +954,7 @@ std::unique_ptr Context::getDDLGuardIfTableDoesntExist(const String & { auto lock = getLock(); - Databases::const_iterator it = shared->databases.find(database); + auto it = shared->databases.find(database); if (shared->databases.end() != it && it->second->isTableExist(*this, table)) return {}; @@ -993,7 +993,7 @@ ASTPtr Context::getCreateTableQuery(const String & database_name, const String & ASTPtr Context::getCreateExternalTableQuery(const String & table_name) const { - TableAndCreateASTs::const_iterator jt = external_tables.find(table_name); + auto jt = external_tables.find(table_name); if (external_tables.end() == jt) throw Exception(fmt::format("Temporary table {} doesn't exist", backQuoteIfNeed(table_name)), ErrorCodes::UNKNOWN_TABLE); @@ -1088,7 +1088,7 @@ void Context::setCurrentQueryId(const String & query_id) UInt64 a; UInt64 b; }; - } random; + } random{}; { auto lock = getLock();