RussellSpitzer commented on code in PR #12672:
URL: https://github.com/apache/iceberg/pull/12672#discussion_r2047493768


##########
core/src/test/java/org/apache/iceberg/TestManifestWriterVersions.java:
##########
@@ -213,27 +228,125 @@ public void testV2ManifestRewriteWithInheritance() 
throws IOException {
     checkRewrittenEntry(readManifest(manifest2), 0L, FileContent.DATA);
   }
 
+  @Test
+  public void testV3Write() throws IOException {
+    ManifestFile manifest = writeManifest(3);
+    checkEntry(
+        readManifest(manifest),
+        ManifestWriter.UNASSIGNED_SEQ,
+        ManifestWriter.UNASSIGNED_SEQ,
+        FileContent.DATA,
+        FIRST_ROW_ID);
+  }
+
+  @Test
+  public void testV3WriteWithInheritance() throws IOException {
+    DataFile withoutFirstRowId =
+        DataFiles.builder(SPEC).copy(DATA_FILE).withFirstRowId(null).build();
+
+    ManifestFile manifest = writeAndReadManifestList(writeManifest(3, 
withoutFirstRowId), 3);
+    checkManifest(manifest, SEQUENCE_NUMBER);
+    assertThat(manifest.content()).isEqualTo(ManifestContent.DATA);
+
+    // v2+ should use the correct sequence number by inheriting it
+    // v3 should use the correct first-row-id by inheriting it
+    checkEntry(
+        readManifest(manifest), SEQUENCE_NUMBER, SEQUENCE_NUMBER, 
FileContent.DATA, FIRST_ROW_ID);
+  }
+
+  @Test
+  public void testV3WriteFirstRowIdAssignment() throws IOException {
+    long rowsPerFile = METRICS.recordCount();
+    DataFile withoutFirstRowId =
+        DataFiles.builder(SPEC).copy(DATA_FILE).withFirstRowId(null).build();
+
+    ManifestFile manifest =
+        writeAndReadManifestList(writeManifest(3, withoutFirstRowId, 
withoutFirstRowId), 3);
+    assertThat(manifest.content()).isEqualTo(ManifestContent.DATA);
+
+    // v2+ should use the correct sequence number by inheriting it
+    // v3 should use the correct first-row-id by inheriting it
+    List<ManifestEntry<DataFile>> entries = readManifestAsList(manifest);
+    long expectedFirstRowId = FIRST_ROW_ID;
+    for (ManifestEntry<DataFile> entry : entries) {
+      checkEntry(entry, SEQUENCE_NUMBER, SEQUENCE_NUMBER, FileContent.DATA, 
expectedFirstRowId);
+      expectedFirstRowId += rowsPerFile;
+    }
+  }
+
+  @Test
+  public void testV3ManifestListRewriteWithInheritance() throws IOException {
+    // write with v1
+    ManifestFile manifest = writeAndReadManifestList(writeManifest(1), 1);
+    checkManifest(manifest, 0L);
+
+    // rewrite existing metadata with v2 manifest list
+    ManifestFile manifest3 = writeAndReadManifestList(manifest, 3);

Review Comment:
   There are two comments in this test mentioning V2 but I think they should be 
V3



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to