anoopj commented on code in PR #16689:
URL: https://github.com/apache/iceberg/pull/16689#discussion_r3388739835


##########
core/src/test/java/org/apache/iceberg/TestTrackingStruct.java:
##########
@@ -433,6 +429,43 @@ void testExistingToTerminalTransitions() {
     assertThat(replaced.snapshotId()).isEqualTo(999L);
   }
 
+  @Test
+  void testExistingPreservesSourceSnapshotId() {
+    Tracking source = sourceTracking();
+    Tracking existing = TrackingBuilder.from(source, 999L).build();
+    assertThat(existing.status()).isEqualTo(EntryStatus.EXISTING);
+    
assertThat(existing.snapshotId()).isEqualTo(source.snapshotId()).isNotEqualTo(999L);
+  }
+
+  @Test
+  void testCarryForwardFromModifiedSourceChangesToExisting() {
+    // A MODIFIED entry from a prior commit carried forward without mutation 
becomes EXISTING,

Review Comment:
   Done



##########
core/src/test/java/org/apache/iceberg/TestEntryStatus.java:
##########
@@ -45,4 +45,20 @@ void fromIdInvalid(int id) {
         .isInstanceOf(ArrayIndexOutOfBoundsException.class)
         .hasMessageContaining(String.valueOf(id));
   }
+
+  @ParameterizedTest
+  @EnumSource(
+      value = EntryStatus.class,

Review Comment:
   Done. 



##########
core/src/test/java/org/apache/iceberg/TestTrackingStruct.java:
##########
@@ -433,6 +429,43 @@ void testExistingToTerminalTransitions() {
     assertThat(replaced.snapshotId()).isEqualTo(999L);
   }
 
+  @Test
+  void testExistingPreservesSourceSnapshotId() {
+    Tracking source = sourceTracking();
+    Tracking existing = TrackingBuilder.from(source, 999L).build();
+    assertThat(existing.status()).isEqualTo(EntryStatus.EXISTING);
+    
assertThat(existing.snapshotId()).isEqualTo(source.snapshotId()).isNotEqualTo(999L);
+  }
+
+  @Test
+  void testCarryForwardFromModifiedSourceChangesToExisting() {
+    // A MODIFIED entry from a prior commit carried forward without mutation 
becomes EXISTING,
+    // preserving the snapshot id of the original add (the modify commit lives 
in dvSnapshotId).
+    Tracking modifiedSource = sourceTrackingWithStatus(EntryStatus.MODIFIED);
+    Tracking carried = TrackingBuilder.from(modifiedSource, 999L).build();
+    assertThat(carried.status()).isEqualTo(EntryStatus.EXISTING);
+    
assertThat(carried.snapshotId()).isEqualTo(modifiedSource.snapshotId()).isNotEqualTo(999L);
+    // the modify-commit pointer and inherited fields are carried forward 
unchanged

Review Comment:
   Removed the second part of the comment. 



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to