anoopj commented on code in PR #17932:
URL: https://github.com/apache/iceberg/pull/17932#discussion_r3926737587


##########
core/src/test/java/org/apache/iceberg/TestTrackedFileAdapters.java:
##########
@@ -346,6 +366,213 @@ void dvDeleteFileAdapterRejectsNullDeletionVector() {
         .hasMessage("Cannot create DV delete file: no deletion vector");
   }
 
+  @ParameterizedTest
+  @EnumSource(
+      value = FileContent.class,
+      names = {"DATA_MANIFEST", "DELETE_MANIFEST"})
+  void manifestFileAdapterDelegation(FileContent contentType) {
+    ByteBuffer keyMetadata = ByteBuffer.wrap(new byte[] {7, 8, 9});
+    TrackedFile file =
+        new TrackedFileStruct(
+            MANIFEST_TRACKING,
+            contentType,
+            FORMAT_VERSION_V4,
+            MANIFEST_FILE_LOCATION,
+            FileFormat.PARQUET,
+            0L,
+            MANIFEST_FILE_SIZE,
+            null,
+            null,
+            null,
+            null,
+            null,
+            MANIFEST_INFO,
+            keyMetadata,
+            null,
+            null);
+
+    ManifestFile manifest = TrackedFileAdapters.asManifestFile(file);
+
+    ManifestContent expectedContent =
+        contentType == FileContent.DATA_MANIFEST ? ManifestContent.DATA : 
ManifestContent.DELETES;
+    assertThat(manifest.path()).isEqualTo(MANIFEST_FILE_LOCATION);
+    assertThat(manifest.length()).isEqualTo(MANIFEST_FILE_SIZE);
+    assertThat(manifest.content()).isEqualTo(expectedContent);
+    assertThat(manifest.sequenceNumber()).isEqualTo(DATA_SEQUENCE_NUMBER);
+    
assertThat(manifest.minSequenceNumber()).isEqualTo(MANIFEST_INFO.minSequenceNumber());
+    assertThat(manifest.snapshotId()).isEqualTo(SNAPSHOT_ID);
+    
assertThat(manifest.addedFilesCount()).isEqualTo(MANIFEST_INFO.addedFilesCount());
+    
assertThat(manifest.addedRowsCount()).isEqualTo(MANIFEST_INFO.addedRowsCount());
+    
assertThat(manifest.existingFilesCount()).isEqualTo(MANIFEST_INFO.existingFilesCount());
+    
assertThat(manifest.existingRowsCount()).isEqualTo(MANIFEST_INFO.existingRowsCount());
+    
assertThat(manifest.deletedFilesCount()).isEqualTo(MANIFEST_INFO.deletedFilesCount());
+    
assertThat(manifest.deletedRowsCount()).isEqualTo(MANIFEST_INFO.deletedRowsCount());
+    assertThat(manifest.firstRowId()).isEqualTo(FIRST_ROW_ID);
+    assertThat(manifest.keyMetadata()).isEqualTo(keyMetadata);
+    
assertThat(manifest.deletionVector()).isEqualTo(ByteBuffer.wrap(MANIFEST_DV));
+    assertThat(manifest.partitions()).isNull();
+  }
+
+  @Test
+  void manifestFileAdapterPartitionSpecIdUnsupported() {
+    TrackedFile file =
+        new TrackedFileStruct(
+            MANIFEST_TRACKING,
+            FileContent.DATA_MANIFEST,
+            FORMAT_VERSION_V4,
+            MANIFEST_FILE_LOCATION,
+            FileFormat.PARQUET,
+            0L,
+            MANIFEST_FILE_SIZE,
+            null,
+            null,
+            null,
+            null,
+            null,
+            MANIFEST_INFO,
+            null,
+            null,
+            null);
+
+    ManifestFile manifest = TrackedFileAdapters.asManifestFile(file);
+
+    assertThatThrownBy(manifest::partitionSpecId)
+        .isInstanceOf(UnsupportedOperationException.class)
+        .hasMessage("v4 manifests are not bound to a single partition spec");

Review Comment:
   My rationale was that the concept doesn't apply anymore, so callers should 
not rely on it. 



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