Catalog#

Interface#

class Catalog#

This interface is responsible for reading and writing metadata such as database/table from a paimon catalog.

Public Functions

virtual Status CreateDatabase(const std::string &name, const std::map<std::string, std::string> &options, bool ignore_if_exists) = 0#

Creates a database with the specified properties.

Parameters:
  • name – Name of the database to be created.

  • options – Additional properties associated with the database.

  • ignore_if_exists – If true, no action is taken if the database already exists. If false, an error status is returned if the database exists.

Returns:

A status indicating success or failure.

virtual Status CreateTable(const Identifier &identifier, ArrowSchema *c_schema, const std::vector<std::string> &partition_keys, const std::vector<std::string> &primary_keys, const std::map<std::string, std::string> &options, bool ignore_if_exists) = 0#

Creates a new table in the catalog.

Note

System tables cannot be created using this method.

Parameters:
  • identifierIdentifier of the table to be created.

  • c_schema – The schema of the table to be created.

  • partition_keys – List of columns that should be used as partition keys for the table.

  • primary_keys – List of columns that should be used as primary keys for the table.

  • options – Additional table-specific options.

  • ignore_if_exists – If true, no action is taken if the table already exists. If false, an error status is returned if the table exists.

Returns:

A status indicating success or failure.

virtual Result<std::vector<std::string>> ListDatabases() const = 0#

Lists all the databases available in the catalog.

Returns:

A result containing a vector of database names, or an error status.

virtual Result<std::vector<std::string>> ListTables(const std::string &db_name) const = 0#

Lists all the tables within a specified database.

Note

System tables will not be listed.

Parameters:

db_name – The name of the database to list tables from.

Returns:

A result containing a vector of table names in the specified database, or an error status.

virtual Result<std::optional<std::shared_ptr<Schema>>> LoadTableSchema(const Identifier &identifier) const = 0#

Loads the latest schema of a specified table.

Note

System tables will not be supported.

Parameters:

identifier – The identifier (database and table name) of the table to load.

Returns:

A result containing table schema if the table exists, or std::nullopt if it doesn’t, or an error status on failure.

Public Static Functions

static Result<std::unique_ptr<Catalog>> Create(const std::string &root_path, const std::map<std::string, std::string> &options)#

Factory method for creating a Catalog instance.

Parameters:
  • root_path – Path to the root directory where the catalog is located.

  • options – Configuration options for catalog initialization.

Returns:

A result containing a unique pointer to a Catalog instance, or an error status.

class Identifier#

An identifier for a table containing database and table name.

Public Functions

Identifier(const std::string &database, const std::string &table)#
bool operator==(const Identifier &other)#
const std::string &GetDatabaseName() const#
const std::string &GetTableName() const#
std::string ToString() const#