Skip to content

feat: add snapshot, snapshot_info, and table core utilities with tests#118

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

feat: add snapshot, snapshot_info, and table core utilities with tests#118
lucasfang wants to merge 1 commit into
apache:mainfrom
lucasfang:migrate_4

Conversation

@lucasfang

Copy link
Copy Markdown
Contributor

Purpose

Linked issue: No linked issue

This change adds snapshot management, snapshot info, and table core utilities with comprehensive test coverage.

Included changes:

  • Snapshot module (src/paimon/core/snapshot.h, src/paimon/core/snapshot.cpp):

    • Adds snapshot data structure and serialization/deserialization logic
    • Provides snapshot metadata management capabilities
  • Snapshot Info module (include/paimon/snapshot/snapshot_info.h, src/paimon/core/snapshot_info.cpp):

    • Adds public API for snapshot information access
    • Implements snapshot info utility functions
  • Table module (src/paimon/core/table/bucket_mode.h, src/paimon/core/table/table.cpp):

    • Adds bucket mode enumeration and table configuration
    • Implements table core operations
  • Test coverage:

    • Adds snapshot_test.cpp with comprehensive test cases for snapshot functionality
    • Adds table_test.cpp with test cases for table operations

Tests

Not run. Local compile, CMake, and gtest environment checks are not part of this PR description.

Test coverage included in this change:

  • snapshot_test.cpp
  • table_test.cpp

API and Format

This change adds public API in include/paimon/snapshot/snapshot_info.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:15

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 new “core utilities” around snapshots and table creation, including a new public SnapshotInfo API, along with unit tests for snapshot/table behaviors.

Changes:

  • Adds Snapshot model with JSON (de)serialization and commit-kind helpers, plus snapshot unit tests.
  • Adds public SnapshotInfo API (include/paimon/snapshot/snapshot_info.h) and implements CommitKindToString.
  • Adds initial table core implementation (Table::Create, FullName) and a bucket mode enum, plus table unit tests.

Reviewed changes

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

Show a summary per file
File Description
src/paimon/core/table/table.cpp Implements Table::Create and FullName
src/paimon/core/table/table_test.cpp Adds gtest coverage for table creation and schema loading failure
src/paimon/core/table/bucket_mode.h Introduces BucketMode enum and related constants
src/paimon/core/snapshot.h Defines Snapshot structure, commit kind, and JSON contract
src/paimon/core/snapshot.cpp Implements commit-kind mapping and JSON (de)serialization
src/paimon/core/snapshot_test.cpp Adds snapshot tests for JSON round-trips and commit kinds
src/paimon/core/snapshot_info.cpp Implements SnapshotInfo::CommitKindToString
include/paimon/snapshot/snapshot_info.h Adds exported public SnapshotInfo API

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

* limitations under the License.
*/

#include "paimon/catalog/table.h"
* limitations under the License.
*/

#include "paimon/catalog/table.h"
Comment on lines +277 to +280
void Snapshot::FromJson(const rapidjson::Value& obj) noexcept(false) {
version_ = RapidJsonUtil::DeserializeKeyValue<int32_t>(obj, FIELD_VERSION, -1);
id_ = RapidJsonUtil::DeserializeKeyValue<int64_t>(obj, FIELD_ID);
schema_id_ = RapidJsonUtil::DeserializeKeyValue<int64_t>(obj, FIELD_SCHEMA_ID);
Comment on lines +238 to +240
obj.AddMember(rapidjson::StringRef(FIELD_TOTAL_RECORD_COUNT),
RapidJsonUtil::SerializeValue(total_record_count_.value(), allocator).Move(),
*allocator);
Comment on lines +241 to +243
obj.AddMember(rapidjson::StringRef(FIELD_DELTA_RECORD_COUNT),
RapidJsonUtil::SerializeValue(delta_record_count_.value(), allocator).Move(),
*allocator);
Comment on lines +122 to +124
default:
assert(false);
return "UNKNOWN";
Comment on lines +137 to +138
assert(false);
return Unknown();
Comment on lines +81 to +85
return version_ == other.version_ && id_ == other.id_ && schema_id_ == other.schema_id_ &&
index_manifest_ == other.index_manifest_ && commit_user_ == other.commit_user_ &&
commit_identifier_ == other.commit_identifier_ && commit_kind_ == other.commit_kind_ &&
log_offsets_ == other.log_offsets_ && total_record_count_ == other.total_record_count_ &&
delta_record_count_ == other.delta_record_count_ &&
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