Skip to content

feat(catalog): add catalog interfaces, file system catalog and snapshot#120

Open
lucasfang wants to merge 1 commit into
apache:mainfrom
lucasfang:migrate_6
Open

feat(catalog): add catalog interfaces, file system catalog and snapshot#120
lucasfang wants to merge 1 commit into
apache:mainfrom
lucasfang:migrate_6

Conversation

@lucasfang

Copy link
Copy Markdown
Contributor

Purpose

Linked issue: No linked issue

This change adds the catalog module, providing core catalog interfaces, a file-system-backed catalog implementation, identifier/table/database abstractions, and snapshot commit utilities.

Included changes:

  • Public API (include/paimon/catalog/):

    • Adds Catalog interface defining table/database lifecycle operations.
    • Adds Table, Database, and Identifier value types for catalog entity representation.
  • File System Catalog (src/paimon/catalog/file_system_catalog.*):

    • Implements FileSystemCatalog backed by local/remote file system storage.
    • Adds comprehensive test coverage in file_system_catalog_test.cpp.
  • Snapshot Commit Utilities (src/paimon/catalog/*snapshot_commit*):

    • Adds SnapshotCommit, CatalogSnapshotCommit, and RenamingSnapshotCommit for atomic snapshot persistence.
    • Adds test coverage for RenamingSnapshotCommit.
  • Catalog Core & Identifier (src/paimon/catalog/catalog.*, identifier.*):

    • Adds Catalog base implementation and CommitTableRequest for table commit workflows.
    • Adds Identifier parsing/formatting logic with test coverage.
    • Adds unit tests for Catalog and CommitTableRequest.

Tests

Test coverage included in this change:

  • CatalogTest
  • FileSystemCatalogTest
  • IdentifierTest
  • CommitTableRequestTest
  • RenamingSnapshotCommitTest

API and Format

This change adds public API in include/paimon/catalog/catalog.h, include/paimon/catalog/table.h, include/paimon/catalog/identifier.h, and include/paimon/catalog/database.h.

No storage format or protocol changes.

Documentation

No documentation changes required.

Generative AI tooling

Migrate-by: Aone Copilot (Qwen3.7-Max)

Copilot AI review requested due to automatic review settings June 25, 2026 06:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new catalog module for paimon-cpp, including public catalog APIs (Catalog, Table, Database, Identifier), a file-system-backed FileSystemCatalog implementation, and snapshot commit utilities (SnapshotCommit + implementations), along with unit tests.

Changes:

  • Added public catalog interfaces and value types under include/paimon/catalog/.
  • Implemented a file-system-backed catalog (FileSystemCatalog) with database/table lifecycle operations and snapshot listing.
  • Added snapshot commit abstractions (SnapshotCommit, CatalogSnapshotCommit, RenamingSnapshotCommit) plus tests.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
src/paimon/catalog/snapshot_commit.h Adds snapshot commit interface used by core commit path.
src/paimon/catalog/renaming_snapshot_commit.h Implements snapshot commit via atomic store + latest hint update.
src/paimon/catalog/renaming_snapshot_commit_test.cpp Unit tests for renaming snapshot commit behavior.
src/paimon/catalog/identifier.cpp Implements Identifier parsing/formatting logic.
src/paimon/catalog/identifier_test.cpp Unit tests for Identifier parsing and validation.
src/paimon/catalog/file_system_catalog.h Declares FileSystemCatalog implementation of the public Catalog API.
src/paimon/catalog/file_system_catalog.cpp Implements filesystem catalog operations (create/drop/rename/list/load schema/snapshots).
src/paimon/catalog/file_system_catalog_test.cpp Extensive tests for filesystem catalog behavior (system tables, drop cleanup, snapshots).
src/paimon/catalog/commit_table_request.h Adds JSON-serializable commit request wrapper (snapshot + stats).
src/paimon/catalog/commit_table_request_test.cpp Tests JSON roundtrip + stable serialization for commit request.
src/paimon/catalog/catalog.cpp Implements Catalog::Create factory returning FileSystemCatalog.
src/paimon/catalog/catalog_test.cpp Tests basic Catalog::Create behavior.
src/paimon/catalog/catalog_snapshot_commit.h Adds CatalogSnapshotCommit implementation that records commit requests.
include/paimon/catalog/table.h Adds public Table abstraction.
include/paimon/catalog/identifier.h Adds public Identifier value type.
include/paimon/catalog/database.h Adds public Database interface.
include/paimon/catalog/catalog.h Adds public Catalog interface and API surface.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +21 to +26
#include <string>
#include <vector>

#include "paimon/core/partition/partition_statistics.h"
#include "paimon/core/snapshot.h"

Comment on lines +47 to +49
Result<bool> Commit(const Snapshot& snapshot,
const std::vector<PartitionStatistics>& statistics) override {
PAIMON_ASSIGN_OR_RAISE(std::string json_str, snapshot.ToJsonString());
Comment on lines +161 to +165
SchemaManager schema_manager(fs_, NewDataTablePath(warehouse_, identifier));
PAIMON_ASSIGN_OR_RAISE(
std::unique_ptr<TableSchema> table_schema,
schema_manager.CreateTable(schema, partition_keys, primary_keys, options));
return Status::OK();
Comment on lines +99 to +101
Result<bool> FileSystemCatalog::TableExists(const Identifier& identifier) const {
PAIMON_ASSIGN_OR_RAISE(bool is_system_table, identifier.IsSystemTable());
if (is_system_table) {
Comment on lines +261 to +265
Result<std::shared_ptr<Schema>> FileSystemCatalog::LoadTableSchema(
const Identifier& identifier) const {
PAIMON_ASSIGN_OR_RAISE(bool is_system_table, identifier.IsSystemTable());
if (is_system_table) {
PAIMON_ASSIGN_OR_RAISE(std::optional<std::string> system_table_name,
Comment on lines +19 to +20
#include "paimon/core/catalog/commit_table_request.h"

Comment on lines +19 to +20
#include "paimon/core/catalog/renaming_snapshot_commit.h"

Comment on lines +26 to +28
#include "paimon/core/catalog/snapshot_commit.h"
#include "paimon/core/snapshot.h"
#include "paimon/core/utils/snapshot_manager.h"
Comment on lines +21 to +26
#include <string>
#include <vector>

#include "paimon/core/catalog/commit_table_request.h"
#include "paimon/core/catalog/snapshot_commit.h"

Comment on lines +19 to +20
#include "paimon/core/catalog/file_system_catalog.h"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants