rdblue commented on code in PR #18853:
URL: https://github.com/apache/iceberg/pull/18853#discussion_r4519269282


##########
core/src/main/java/org/apache/iceberg/V4Metadata.java:
##########
@@ -541,4 +548,730 @@ public Long pos() {
       return null;
     }
   }
+
+  /** Base wrapper used to write a {@link TrackedFile} using the v4 tracked 
file schema. */
+  private static void checkNullSequenceNumbers(TrackedFile file, Tracking 
tracking) {
+    // null sequence numbers are inherited from the commit: ADDED entries 
inherit both and
+    // MODIFIED entries inherit only the data sequence number
+    EntryStatus status = tracking.status();
+    Preconditions.checkState(
+        tracking.dataSequenceNumber() != null
+            || status == EntryStatus.ADDED
+            || status == EntryStatus.MODIFIED,
+        "Cannot write null data sequence number for status %s (must be ADDED 
or MODIFIED): %s",
+        status,
+        file.location());
+    Preconditions.checkState(
+        tracking.fileSequenceNumber() != null || status == EntryStatus.ADDED,
+        "Cannot write null file sequence number for status %s (must be ADDED): 
%s",
+        status,
+        file.location());
+  }
+
+  private abstract static class TrackedFileWrapper implements TrackedFile, 
StructLike {

Review Comment:
   It would probably be cleaner to use the approach we used for v3, where there 
is a class in `Delegates` that handles the `TrackedFile` methods. Then this 
just needs to handle `StructLike`.



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