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

JingsongLi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/paimon-rust.git


The following commit(s) were added to refs/heads/main by this push:
     new 0c34b09  fix: preserve snapshot properties (#395)
0c34b09 is described below

commit 0c34b09d8db2ef4461bc908e6a129c4a6e1afb74
Author: WenjunMin <[email protected]>
AuthorDate: Fri Jun 19 20:36:20 2026 +0800

    fix: preserve snapshot properties (#395)
---
 crates/paimon/src/spec/snapshot.rs                     | 14 ++++++++++++++
 crates/paimon/tests/fixtures/snapshot/snapshot-v3.json |  7 +++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/crates/paimon/src/spec/snapshot.rs 
b/crates/paimon/src/spec/snapshot.rs
index ef6664c..5ea930d 100644
--- a/crates/paimon/src/spec/snapshot.rs
+++ b/crates/paimon/src/spec/snapshot.rs
@@ -103,6 +103,10 @@ pub struct Snapshot {
     #[builder(default = None)]
     #[serde(skip_serializing_if = "Option::is_none")]
     statistics: Option<String>,
+    /// user-facing properties of this snapshot
+    #[builder(default = None)]
+    #[serde(skip_serializing_if = "Option::is_none")]
+    properties: Option<HashMap<String, String>>,
     /// next row id for row tracking
     #[builder(default = None)]
     #[serde(skip_serializing_if = "Option::is_none")]
@@ -206,6 +210,12 @@ impl Snapshot {
         self.statistics.as_deref()
     }
 
+    /// Get the properties of this snapshot.
+    #[inline]
+    pub fn properties(&self) -> Option<&HashMap<String, String>> {
+        self.properties.as_ref()
+    }
+
     /// Get the next row id of this snapshot.
     #[inline]
     pub fn next_row_id(&self) -> Option<i64> {
@@ -261,6 +271,10 @@ mod tests {
                     .delta_record_count(Some(2))
                     .changelog_record_count(Some(2))
                     .statistics(Some("statistics_string".to_string()))
+                    .properties(Some(HashMap::from([(
+                        "scan.snapshot-id".to_string(),
+                        "2".to_string(),
+                    )])))
                     .build(),
             ),
             (
diff --git a/crates/paimon/tests/fixtures/snapshot/snapshot-v3.json 
b/crates/paimon/tests/fixtures/snapshot/snapshot-v3.json
index 894c984..935bcd8 100644
--- a/crates/paimon/tests/fixtures/snapshot/snapshot-v3.json
+++ b/crates/paimon/tests/fixtures/snapshot/snapshot-v3.json
@@ -13,5 +13,8 @@
   "totalRecordCount": 4,
   "deltaRecordCount": 2,
   "changelogRecordCount": 2,
-  "statistics": "statistics_string"
-}
\ No newline at end of file
+  "statistics": "statistics_string",
+  "properties": {
+    "scan.snapshot-id": "2"
+  }
+}

Reply via email to