stevenzwu commented on code in PR #19007:
URL: https://github.com/apache/iceberg/pull/19007#discussion_r4603976238


##########
core/src/test/java/org/apache/iceberg/TestV4ManifestWriter.java:
##########
@@ -161,6 +162,61 @@ class TestV4ManifestWriter {
           List.of(4L),
           List.of(COLUMN_FILE_A));
 
+  private static final ColumnFile REPLACE_DV_COLUMNS =
+      new ColumnFileStruct(
+          "s3://bucket/db/table/data/leaf-40-1-dv-update.parquet",
+          Set.of(TrackedFile.DELETION_VECTOR.fieldId(), 
TrackedFile.TIGHT_STATS.fieldId()),
+          FileFormat.PARQUET,
+          512,
+          null);
+
+  // a generic manifest info; row count = 100 * file count
+  private static final ManifestInfo MANIFEST_INFO =
+      new ManifestInfoStruct(2, 10, 2, 4, 4, 200, 1_000, 200, 400, 400, 34L, 
null /* MDV */, 4);
+
+  private static final ManifestBitmap MDV = 
MumblingBitmaps.newMutableBitmap(4, 8, 12);
+
+  private static final ManifestInfo MANIFEST_INFO_WITH_MDV =
+      new ManifestInfoStruct(2, 10, 2, 4, 4, 200, 1_000, 200, 400, 400, 34L, 
MDV, 4);
+
+  private static final TrackedFile LEAF_MANIFEST =
+      new TrackedFileStruct(
+          new TrackingStruct(EntryStatus.EXISTING, 40L, 35L, 35L, null, 500L, 
null, null),
+          FileContent.DATA_MANIFEST,
+          "s3://bucket/db/table/metadata/leaf-40-1.parquet",
+          FileFormat.PARQUET,
+          100,
+          1024,
+          null, // unpartitioned
+          null, // unpartitioned
+          CONTENT_STATS_A,
+          false,
+          null, // no sort order for manifests
+          null, // no external DV for manifests,

Review Comment:
   Nit:  `// no data DV for manifests`. The trailing comma in the comment 
should go too. Same on line 214.



##########
core/src/test/java/org/apache/iceberg/TestV4ManifestWriter.java:
##########
@@ -546,6 +620,379 @@ public void rootDataFileFirstRowIdAssignment() throws 
IOException {
     }
   }
 
+  @Test
+  public void rootManifestFileAppend() throws IOException {
+    OutputFile output = new InMemoryOutputFile("manifest.parquet");
+    V4ManifestWriter writer =
+        V4ManifestWriter.createRoot(
+            EncryptionUtil.plainAsEncryptedOutput(output),
+            Map.of(),
+            STATS_TYPE,
+            Map.of(),
+            SCHEMA.schemaId(),
+            COMMIT_SNAPSHOT_ID,
+            COMMIT_SEQUENCE_NUMBER,
+            COMMIT_FIRST_ROW_ID);
+    try (writer) {
+      writer.append(LEAF_MANIFEST);

Review Comment:
   `LEAF_MANIFEST` is constructed as an existing leaf. `append` adds new leaf 
manifest, which contradicts this fixture. Use a new leaf with null tracking for 
all append tests, and keep `EXISTING` for `existing`, `delete`, and `replace`.
   



##########
core/src/main/java/org/apache/iceberg/V4ManifestWriter.java:
##########
@@ -113,8 +114,8 @@ private V4ManifestWriter(
 
   protected abstract StructLike prepare(TrackedFile file, Tracking tracking);
 
-  // TODO: add row ID space to spec and ManifestInfo
-  public long assignedRowIds() {
+  @VisibleForTesting
+  long assignedRowIds() {

Review Comment:
   This name doesn't fit leaf writers. It returns rows that still need a 
first-row-id from the root, not IDs this writer assigned. Consider 
`unassignedRowCount()`, and keep `assignedRowIds()` for the root writer only.
   



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