huaxingao commented on code in PR #19019:
URL: https://github.com/apache/iceberg/pull/19019#discussion_r4699951686


##########
core/src/main/java/org/apache/iceberg/TrackedFileAdapters.java:
##########
@@ -533,6 +539,11 @@ public Long firstRowId() {
       return file.tracking() != null ? file.tracking().firstRowId() : null;
     }
 
+    @Override
+    public Long snapshotTimestampMicros() {
+      return file.tracking().snapshotTimestampMicros();

Review Comment:
   A manifest from `V4ManifestWriter.toTrackedManifest()` has no tracking until 
it is committed, and #19030 added null checks to `sequenceNumber()`, 
`snapshotId()`, and `firstRowId()` here for that case. Should this one have the 
same check?
   
   ```java
   return file.tracking() != null ? file.tracking().snapshotTimestampMicros() : 
null;
   ```
   
   This test fails with an NPE on the current code and passes with the change:
   
   ```java
   @Test
   void manifestFileAdapterWithoutTracking() {
     TrackedFile file = Mockito.mock(TrackedFile.class);
     Mockito.when(file.contentType()).thenReturn(FileContent.DATA_MANIFEST);
   
     ManifestFile manifest = TrackedFileAdapters.asManifestFile(file);
   
     assertThat(manifest.firstRowId()).isNull();
     assertThat(manifest.snapshotTimestampMicros()).isNull();
   }
   ```



##########
core/src/main/java/org/apache/iceberg/TrackingStruct.java:
##########
@@ -62,6 +63,7 @@ class TrackingStruct extends SupportsIndexProjection 
implements Tracking, Serial
   private Long firstRowId = null;
   private byte[] deletedPositions = null;
   private byte[] replacedPositions = null;
+  private Long snapshotTimestampMicros = null;

Review Comment:
   Thanks, I see this was settled on #18526: ADDED entries keep a null 
`snapshot_timestamp`, also in the root manifest, and readers inherit it from 
the snapshot. That answers my question.



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