feat(catalog): add catalog interfaces, file system catalog and snapshot#120
Open
lucasfang wants to merge 1 commit into
Open
feat(catalog): add catalog interfaces, file system catalog and snapshot#120lucasfang wants to merge 1 commit into
lucasfang wants to merge 1 commit into
Conversation
…ot commit utilities
There was a problem hiding this comment.
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" | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/):Cataloginterface defining table/database lifecycle operations.Table,Database, andIdentifiervalue types for catalog entity representation.File System Catalog (
src/paimon/catalog/file_system_catalog.*):FileSystemCatalogbacked by local/remote file system storage.file_system_catalog_test.cpp.Snapshot Commit Utilities (
src/paimon/catalog/*snapshot_commit*):SnapshotCommit,CatalogSnapshotCommit, andRenamingSnapshotCommitfor atomic snapshot persistence.RenamingSnapshotCommit.Catalog Core & Identifier (
src/paimon/catalog/catalog.*,identifier.*):Catalogbase implementation andCommitTableRequestfor table commit workflows.Identifierparsing/formatting logic with test coverage.CatalogandCommitTableRequest.Tests
Test coverage included in this change:
CatalogTestFileSystemCatalogTestIdentifierTestCommitTableRequestTestRenamingSnapshotCommitTestAPI and Format
This change adds public API in
include/paimon/catalog/catalog.h,include/paimon/catalog/table.h,include/paimon/catalog/identifier.h, andinclude/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)