22#include <gmock/gmock.h>
23#include <gtest/gtest.h>
25#include "iceberg/catalog.h"
34 MOCK_METHOD(std::string_view,
name, (), (
const,
override));
37 (
const Namespace&, (
const std::unordered_map<std::string, std::string>&)),
43 MOCK_METHOD((Result<std::unordered_map<std::string, std::string>>),
47 (
const Namespace&, (
const std::unordered_map<std::string, std::string>&),
48 (
const std::unordered_set<std::string>&)),
58 MOCK_METHOD((Result<std::shared_ptr<Table>>),
CreateTable,
60 const std::shared_ptr<PartitionSpec>&,
const std::shared_ptr<SortOrder>&,
61 const std::string&, (
const std::unordered_map<std::string, std::string>&)),
64 MOCK_METHOD((Result<std::shared_ptr<Table>>),
UpdateTable,
66 (
const std::vector<std::unique_ptr<TableRequirement>>&),
67 (
const std::vector<std::unique_ptr<TableUpdate>>&)),
72 const std::shared_ptr<PartitionSpec>&,
const std::shared_ptr<SortOrder>&,
73 const std::string&, (
const std::unordered_map<std::string, std::string>&)),
A Catalog API for table create, drop, and load operations.
Definition catalog.h:39
virtual Result< bool > NamespaceExists(const Namespace &ns) const =0
Check whether the namespace exists.
virtual Status DropTable(const TableIdentifier &identifier, bool purge)=0
Drop a table; optionally delete data and metadata files.
virtual Result< std::shared_ptr< Table > > CreateTable(const TableIdentifier &identifier, const std::shared_ptr< Schema > &schema, const std::shared_ptr< PartitionSpec > &spec, const std::shared_ptr< SortOrder > &order, const std::string &location, const std::unordered_map< std::string, std::string > &properties)=0
Create a table.
virtual Result< std::shared_ptr< Transaction > > StageCreateTable(const TableIdentifier &identifier, const std::shared_ptr< Schema > &schema, const std::shared_ptr< PartitionSpec > &spec, const std::shared_ptr< SortOrder > &order, const std::string &location, const std::unordered_map< std::string, std::string > &properties)=0
Start a transaction to create a table.
virtual Status UpdateNamespaceProperties(const Namespace &ns, const std::unordered_map< std::string, std::string > &updates, const std::unordered_set< std::string > &removals)=0
Update a namespace's properties by applying additions and removals.
virtual Result< std::shared_ptr< Table > > UpdateTable(const TableIdentifier &identifier, const std::vector< std::unique_ptr< TableRequirement > > &requirements, const std::vector< std::unique_ptr< TableUpdate > > &updates)=0
Update a table.
virtual std::string_view name() const =0
Return the name for this catalog.
virtual Status DropNamespace(const Namespace &ns)=0
Drop a namespace.
virtual Result< bool > TableExists(const TableIdentifier &identifier) const =0
Check whether table exists.
virtual Result< std::shared_ptr< Table > > LoadTable(const TableIdentifier &identifier)=0
Load a table.
virtual Result< std::vector< TableIdentifier > > ListTables(const Namespace &ns) const =0
Return all the identifiers under this namespace.
virtual Result< std::vector< Namespace > > ListNamespaces(const Namespace &ns) const =0
List child namespaces from the given namespace.
virtual Result< std::shared_ptr< Table > > RegisterTable(const TableIdentifier &identifier, const std::string &metadata_file_location)=0
Register a table with the catalog if it does not exist.
virtual Status RenameTable(const TableIdentifier &from, const TableIdentifier &to)=0
Rename a table.
virtual Result< std::unordered_map< std::string, std::string > > GetNamespaceProperties(const Namespace &ns) const =0
Get metadata properties for a namespace.
virtual Status CreateNamespace(const Namespace &ns, const std::unordered_map< std::string, std::string > &properties)=0
Create a namespace with associated properties.
Definition mock_catalog.h:29
A namespace in a catalog.
Definition table_identifier.h:35
Identifies a table in iceberg catalog.
Definition table_identifier.h:46