tsreaper commented on code in PR #7706:
URL: https://github.com/apache/paimon/pull/7706#discussion_r3206064015


##########
paimon-core/src/test/java/org/apache/paimon/operation/ExpireSnapshotsTest.java:
##########
@@ -740,6 +799,34 @@ private TestFileStore createStore() {
                 .build();
     }
 
+    private void rewriteSnapshotTime(long snapshotId, long newTimeMillis) 
throws IOException {
+        Snapshot old = snapshotManager.snapshot(snapshotId);
+        Snapshot updated =
+                new Snapshot(
+                        old.id(),
+                        old.schemaId(),
+                        old.baseManifestList(),
+                        old.baseManifestListSize(),
+                        old.deltaManifestList(),
+                        old.deltaManifestListSize(),
+                        old.changelogManifestList(),
+                        old.changelogManifestListSize(),
+                        old.indexManifest(),
+                        old.commitUser(),
+                        old.commitIdentifier(),
+                        old.commitKind(),
+                        newTimeMillis,
+                        old.totalRecordCount(),
+                        old.deltaRecordCount(),
+                        old.changelogRecordCount(),
+                        old.watermark(),
+                        old.statistics(),
+                        old.properties(),
+                        old.nextRowId());
+        fileIO.overwriteFileUtf8(snapshotManager.snapshotPath(snapshotId), 
updated.toJson());

Review Comment:
   ```suggestion
           String oldJson = 
fileIO.readFileUtf8(snapshotManager.snapshotPath(snapshotId));
           ObjectNode node = (ObjectNode) 
JsonSerdeUtil.OBJECT_MAPPER_INSTANCE.readTree(oldJson);
           node.put(Snapshot.FIELD_TIME_MILLIS, newTimeMillis);
           String newJson = 
JsonSerdeUtil.OBJECT_MAPPER_INSTANCE.writeValueAsString(node);
           fileIO.overwriteFileUtf8(snapshotManager.snapshotPath(snapshotId), 
newJson);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to