diff --git a/include/paimon/catalog/catalog.h b/include/paimon/catalog/catalog.h index c7801fcb..058acd89 100644 --- a/include/paimon/catalog/catalog.h +++ b/include/paimon/catalog/catalog.h @@ -100,7 +100,7 @@ class PAIMON_EXPORT Catalog { /// @param db_name The name of the database to check for existence. /// @return A result containing true if the database exists, false otherwise, or an error /// status. - virtual Result DataBaseExists(const std::string& db_name) const = 0; + virtual Result DatabaseExists(const std::string& db_name) const = 0; /// Checks whether a table with the specified identifier exists in the catalog. /// diff --git a/src/paimon/core/catalog/file_system_catalog.cpp b/src/paimon/core/catalog/file_system_catalog.cpp index a8bef047..fa3fc33a 100644 --- a/src/paimon/core/catalog/file_system_catalog.cpp +++ b/src/paimon/core/catalog/file_system_catalog.cpp @@ -49,7 +49,7 @@ Status FileSystemCatalog::CreateDatabase(const std::string& db_name, return Status::Invalid( fmt::format("Cannot create database for system database {}.", db_name)); } - PAIMON_ASSIGN_OR_RAISE(bool exist, DataBaseExists(db_name)); + PAIMON_ASSIGN_OR_RAISE(bool exist, DatabaseExists(db_name)); if (exist) { if (ignore_if_exists) { return Status::OK(); @@ -78,10 +78,10 @@ Status FileSystemCatalog::CreateDatabaseImpl(const std::string& db_name, return Status::OK(); } -Result FileSystemCatalog::DataBaseExists(const std::string& db_name) const { +Result FileSystemCatalog::DatabaseExists(const std::string& db_name) const { if (IsSystemDatabase(db_name)) { return Status::NotImplemented( - "do not support checking DataBaseExists for system database."); + "do not support checking DatabaseExists for system database."); } return fs_->Exists(NewDatabasePath(warehouse_, db_name)); } @@ -102,7 +102,7 @@ Status FileSystemCatalog::CreateTable(const Identifier& identifier, ArrowSchema* fmt::format("Cannot create table for system table {}, please use data table.", identifier.ToString())); } - PAIMON_ASSIGN_OR_RAISE(bool db_exist, DataBaseExists(identifier.GetDatabaseName())); + PAIMON_ASSIGN_OR_RAISE(bool db_exist, DatabaseExists(identifier.GetDatabaseName())); if (!db_exist) { return Status::Invalid( fmt::format("database {} is not exist", identifier.GetDatabaseName())); diff --git a/src/paimon/core/catalog/file_system_catalog.h b/src/paimon/core/catalog/file_system_catalog.h index 04d09d00..63e63272 100644 --- a/src/paimon/core/catalog/file_system_catalog.h +++ b/src/paimon/core/catalog/file_system_catalog.h @@ -48,8 +48,8 @@ class FileSystemCatalog : public Catalog { bool ignore_if_exists) override; Result> ListDatabases() const override; - Result> ListTables(const std::string& database_names) const override; - Result DataBaseExists(const std::string& db_name) const override; + Result> ListTables(const std::string& db_name) const override; + Result DatabaseExists(const std::string& db_name) const override; Result TableExists(const Identifier& identifier) const override; Result> LoadTableSchema(const Identifier& identifier) const override; diff --git a/src/paimon/core/catalog/file_system_catalog_test.cpp b/src/paimon/core/catalog/file_system_catalog_test.cpp index 14467cf5..ede3b2bd 100644 --- a/src/paimon/core/catalog/file_system_catalog_test.cpp +++ b/src/paimon/core/catalog/file_system_catalog_test.cpp @@ -32,7 +32,7 @@ namespace paimon::test { -TEST(FileSystemCatalogTest, TestDataBaseExists) { +TEST(FileSystemCatalogTest, TestDatabaseExists) { std::map options; options[Options::FILE_SYSTEM] = "local"; options[Options::FILE_FORMAT] = "orc"; @@ -41,14 +41,14 @@ TEST(FileSystemCatalogTest, TestDataBaseExists) { ASSERT_TRUE(dir); FileSystemCatalog catalog(core_options.GetFileSystem(), dir->Str()); - ASSERT_OK_AND_ASSIGN(auto exist, catalog.DataBaseExists("db1")); + ASSERT_OK_AND_ASSIGN(auto exist, catalog.DatabaseExists("db1")); ASSERT_FALSE(exist); ASSERT_OK(catalog.CreateDatabase("db1", options, /*ignore_if_exists=*/false)); ASSERT_NOK(catalog.CreateDatabase("db1", options, /*ignore_if_exists=*/false)); ASSERT_OK(catalog.CreateDatabase("db1", options, /*ignore_if_exists=*/true)); - ASSERT_OK_AND_ASSIGN(exist, catalog.DataBaseExists("db1")); + ASSERT_OK_AND_ASSIGN(exist, catalog.DatabaseExists("db1")); ASSERT_TRUE(exist); ASSERT_OK_AND_ASSIGN(std::vector db_names, catalog.ListDatabases()); ASSERT_EQ(1, db_names.size());