amogh-jahagirdar commented on code in PR #18795:
URL: https://github.com/apache/iceberg/pull/18795#discussion_r4485764498


##########
core/src/main/java/org/apache/iceberg/V4ManifestReader.java:
##########
@@ -150,20 +145,27 @@ public CloseableIterator<TrackedFile> iterator() {
     return CloseableIterable.transform(files, this::copyResolved).iterator();
   }
 
-  private TrackedFile applyInheritance(TrackedFile file) {
-    // the reader uses TrackingStruct to read tracking so this cast is safe
-    TrackingStruct tracking = (TrackingStruct) file.tracking();
-    if (isUncommitted) {
-      // uncommitted files cannot have a sequence number or assign first row ID
-      tracking.inherit(manifest.snapshotId());
-    } else {
-      tracking.inherit(manifest.snapshotId(), manifest.sequenceNumber());
-      if (tracking.assignFirstRowId(nextRowId)) {
-        this.nextRowId += file.recordCount();
-      }
-    }
+  private Function<TrackedFile, TrackedFile> applyInheritance() {
+    return new Function<>() {
+      private Long nextRowId = manifest.firstRowId();

Review Comment:
   Minor: this is boxed, so every `+=` is somewhat on the hot path when reading 
entries. `idAssigner` avoids that by handling the null `first_row_id` case 
before building the function, so it can keep a primitive `long`. Could we do 
the same here? If the manifest's `first_row_id` is null, we'd just return a 
function that does `assignFirstRowId(null)` for each file.



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