This is an automated email from the ASF dual-hosted git repository.

lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new 6876bb94c8 [python] Update PyPaimon Snapshot fields to not null (#6926)
6876bb94c8 is described below

commit 6876bb94c85434f7c63e65970d9c1fa1b1f15c90
Author: Jingsong Lee <[email protected]>
AuthorDate: Mon Dec 29 17:39:10 2025 +0800

    [python] Update PyPaimon Snapshot fields to not null (#6926)
---
 paimon-python/pypaimon/snapshot/snapshot.py                      | 9 ++++-----
 .../pypaimon/tests/rest/rest_catalog_commit_snapshot_test.py     | 5 +++--
 paimon-python/pypaimon/tests/rest/rest_server.py                 | 5 +++--
 paimon-python/pypaimon/write/file_store_commit.py                | 2 +-
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/paimon-python/pypaimon/snapshot/snapshot.py 
b/paimon-python/pypaimon/snapshot/snapshot.py
index d5f72dedcf..b1fdbaafea 100644
--- a/paimon-python/pypaimon/snapshot/snapshot.py
+++ b/paimon-python/pypaimon/snapshot/snapshot.py
@@ -17,7 +17,7 @@
 
################################################################################
 
 from dataclasses import dataclass
-from typing import Dict, Optional
+from typing import Optional
 
 from pypaimon.common.json_util import json_field
 
@@ -27,21 +27,20 @@ BATCH_COMMIT_IDENTIFIER = 0x7fffffffffffffff
 @dataclass
 class Snapshot:
     # Required fields
+    version: int = json_field("version")
     id: int = json_field("id")
     schema_id: int = json_field("schemaId")
     base_manifest_list: str = json_field("baseManifestList")
     delta_manifest_list: str = json_field("deltaManifestList")
+    total_record_count: int = json_field("totalRecordCount")
+    delta_record_count: int = json_field("deltaRecordCount")
     commit_user: str = json_field("commitUser")
     commit_identifier: int = json_field("commitIdentifier")
     commit_kind: str = json_field("commitKind")
     time_millis: int = json_field("timeMillis")
     # Optional fields with defaults
-    version: Optional[int] = json_field("version", default=None)
-    log_offsets: Optional[Dict[int, int]] = json_field("logOffsets", 
default_factory=dict)
     changelog_manifest_list: Optional[str] = 
json_field("changelogManifestList", default=None)
     index_manifest: Optional[str] = json_field("indexManifest", default=None)
-    total_record_count: Optional[int] = json_field("totalRecordCount", 
default=None)
-    delta_record_count: Optional[int] = json_field("deltaRecordCount", 
default=None)
     changelog_record_count: Optional[int] = json_field("changelogRecordCount", 
default=None)
     watermark: Optional[int] = json_field("watermark", default=None)
     statistics: Optional[str] = json_field("statistics", default=None)
diff --git 
a/paimon-python/pypaimon/tests/rest/rest_catalog_commit_snapshot_test.py 
b/paimon-python/pypaimon/tests/rest/rest_catalog_commit_snapshot_test.py
index f038f3c0ae..e9f95d3d0b 100644
--- a/paimon-python/pypaimon/tests/rest/rest_catalog_commit_snapshot_test.py
+++ b/paimon-python/pypaimon/tests/rest/rest_catalog_commit_snapshot_test.py
@@ -57,11 +57,12 @@ class TestRESTCatalogCommitSnapshot(unittest.TestCase):
             schema_id=0,
             base_manifest_list="manifest-list-1",
             delta_manifest_list="manifest-list-1",
+            total_record_count=1,
+            delta_record_count=1,
             commit_user="test_user",
             commit_identifier=12345,
             commit_kind="APPEND",
-            time_millis=int(time.time() * 1000),
-            log_offsets={}
+            time_millis=int(time.time() * 1000)
         )
 
         # Create test statistics
diff --git a/paimon-python/pypaimon/tests/rest/rest_server.py 
b/paimon-python/pypaimon/tests/rest/rest_server.py
index 1970b79dd0..b97d015dbe 100755
--- a/paimon-python/pypaimon/tests/rest/rest_server.py
+++ b/paimon-python/pypaimon/tests/rest/rest_server.py
@@ -541,11 +541,12 @@ class RESTCatalogServer:
             "schemaId": getattr(snapshot, 'schema_id', 0),
             "baseManifestList": getattr(snapshot, 'base_manifest_list', 
f"manifest-list-{uuid.uuid4()}"),
             "deltaManifestList": getattr(snapshot, 'delta_manifest_list', 
f"manifest-list-{uuid.uuid4()}"),
+            "totalRecordCount": getattr(snapshot, 'total_record_count'),
+            "deltaRecordCount": getattr(snapshot, 'delta_record_count'),
             "commitUser": getattr(snapshot, 'commit_user', 'rest-server'),
             "commitIdentifier": getattr(snapshot, 'commit_identifier', 1),
             "commitKind": getattr(snapshot, 'commit_kind', 'APPEND'),
-            "timeMillis": getattr(snapshot, 'time_millis', 1703721600000),
-            "logOffsets": getattr(snapshot, 'log_offsets', {})
+            "timeMillis": getattr(snapshot, 'time_millis', 1703721600000)
         }
 
         with open(snapshot_file, 'w') as f:
diff --git a/paimon-python/pypaimon/write/file_store_commit.py 
b/paimon-python/pypaimon/write/file_store_commit.py
index 42b1e0ca24..e30b272e26 100644
--- a/paimon-python/pypaimon/write/file_store_commit.py
+++ b/paimon-python/pypaimon/write/file_store_commit.py
@@ -199,7 +199,7 @@ class FileStoreCommit:
         new_snapshot_id = self._generate_snapshot_id()
         total_record_count += delta_record_count
         snapshot_data = Snapshot(
-            version=1,
+            version=3,
             id=new_snapshot_id,
             schema_id=self.table.table_schema.id,
             base_manifest_list=base_manifest_list,

Reply via email to