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


##########
core/src/test/java/org/apache/iceberg/TestTrackedFileStruct.java:
##########
@@ -294,112 +243,52 @@ void testProjectedStructLike() {
   }
 
   @Test
-  void testContentStatsReturnedWhenPresent() {
-    TrackedFileStruct file = createTrackedFileWithStats();
-    assertThat(file.contentStats()).isNotNull();
-    assertThat(file.contentStats().fieldStats()).hasSize(2);
-  }
-
-  @Test
-  void testContentStatsNullWhenNotSet() {
+  void structLikeSize() {
     TrackedFileStruct file = new TrackedFileStruct();
-    file.set(CONTENT_TYPE_ORDINAL, FileContent.DATA.id());
-    file.set(LOCATION_ORDINAL, "test");
-    file.set(FILE_FORMAT_ORDINAL, "parquet");
-    file.set(RECORD_COUNT_ORDINAL, 0L);
-    file.set(FILE_SIZE_IN_BYTES_ORDINAL, 0L);
-    file.set(SPEC_ID_ORDINAL, 0);
-
-    assertThat(file.contentStats()).isNull();
-  }
-
-  @Test
-  void testAllFileContentTypesSupported() {
-    for (FileContent content : FileContent.values()) {
-      TrackedFileStruct file = new TrackedFileStruct();
-      file.set(CONTENT_TYPE_ORDINAL, content.id());
-      assertThat(file.contentType()).isEqualTo(content);
-    }
+    assertThat(file.size()).isEqualTo(16);
   }
 
-  @Test
-  void testJavaSerializationRoundTrip() throws IOException, 
ClassNotFoundException {
-    TrackedFileStruct file = createFullTrackedFile();
-
-    TrackedFileStruct deserialized = TestHelpers.roundTripSerialize(file);
+  @ParameterizedTest
+  @MethodSource("org.apache.iceberg.TestHelpers#serializers")
+  void serializationRoundTrip(RoundTripSerializer<TrackedFileStruct> 
serializer) throws Exception {
+    TrackedFileStruct file =
+        new TrackedFileStruct(
+            TRACKING,
+            FileContent.DATA,
+            FORMAT_VERSION_V4,
+            "s3://bucket/data/file.parquet",
+            FileFormat.PARQUET,
+            PARTITION,
+            100L,
+            1024L,
+            7,
+            null,
+            1,
+            DELETION_VECTOR,
+            MANIFEST_INFO,
+            ByteBuffer.wrap(new byte[] {1, 2, 3}),
+            ImmutableList.of(50L),
+            ImmutableList.of(1, 2, 3));
+
+    TrackedFileStruct deserialized = serializer.apply(file);
 
-    assertThat(deserialized.contentType()).isEqualTo(FileContent.DATA);
-    assertThat(deserialized.formatVersion()).isEqualTo(FORMAT_VERSION_V4);
-    
assertThat(deserialized.location()).isEqualTo("s3://bucket/data/file.parquet");
-    assertThat(deserialized.fileFormat()).isEqualTo(FileFormat.PARQUET);
-    assertThat(deserialized.recordCount()).isEqualTo(100L);
-    assertThat(deserialized.fileSizeInBytes()).isEqualTo(1024L);
-    assertThat(deserialized.specId()).isEqualTo(0);
-    assertThat(deserialized.sortOrderId()).isEqualTo(1);
     assertThat(deserialized.tracking().status()).isEqualTo(EntryStatus.ADDED);
     assertThat(deserialized.tracking().snapshotId()).isEqualTo(42L);

Review Comment:
   no downside, in fact we arguably should just assert all the fields to make 
sure the whole structure round trips as expected. Using a struct like 
comparator for the comparison now.



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