Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/paimon/catalog/catalog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool> DataBaseExists(const std::string& db_name) const = 0;
virtual Result<bool> DatabaseExists(const std::string& db_name) const = 0;

/// Checks whether a table with the specified identifier exists in the catalog.
///
Expand Down
8 changes: 4 additions & 4 deletions src/paimon/core/catalog/file_system_catalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -78,10 +78,10 @@ Status FileSystemCatalog::CreateDatabaseImpl(const std::string& db_name,
return Status::OK();
}

Result<bool> FileSystemCatalog::DataBaseExists(const std::string& db_name) const {
Result<bool> 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));
}
Expand All @@ -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()));
Expand Down
4 changes: 2 additions & 2 deletions src/paimon/core/catalog/file_system_catalog.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class FileSystemCatalog : public Catalog {
bool ignore_if_exists) override;

Result<std::vector<std::string>> ListDatabases() const override;
Result<std::vector<std::string>> ListTables(const std::string& database_names) const override;
Result<bool> DataBaseExists(const std::string& db_name) const override;
Result<std::vector<std::string>> ListTables(const std::string& db_name) const override;
Result<bool> DatabaseExists(const std::string& db_name) const override;
Result<bool> TableExists(const Identifier& identifier) const override;
Result<std::shared_ptr<Schema>> LoadTableSchema(const Identifier& identifier) const override;

Expand Down
6 changes: 3 additions & 3 deletions src/paimon/core/catalog/file_system_catalog_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

namespace paimon::test {

TEST(FileSystemCatalogTest, TestDataBaseExists) {
TEST(FileSystemCatalogTest, TestDatabaseExists) {
std::map<std::string, std::string> options;
options[Options::FILE_SYSTEM] = "local";
options[Options::FILE_FORMAT] = "orc";
Expand All @@ -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<std::string> db_names, catalog.ListDatabases());
ASSERT_EQ(1, db_names.size());
Expand Down
Loading