gaborkaszab commented on code in PR #18924:
URL: https://github.com/apache/iceberg/pull/18924#discussion_r4585998928


##########
core/src/test/java/org/apache/iceberg/TestSnapshot.java:
##########
@@ -74,14 +74,82 @@ void snapshotWithRootManifestExposesLocation() {
             1 /* schemaId */,
             null /* manifestList */,
             "root-manifest.parquet" /* rootManifest */,
+            1024L /* rootSizeInBytes */,
             10L /* firstRowId */,
             5L /* addedRows */,
             "key-1" /* keyId */);
 
     
assertThat(snapshot.rootManifestLocation()).isEqualTo("root-manifest.parquet");
+    assertThat(snapshot.rootSizeInBytes()).isEqualTo(1024L);
     assertThat(snapshot.manifestListLocation()).isNull();
   }
 
+  @TestTemplate
+  void rejectsRootManifestWithoutSize() {
+    assertThatThrownBy(
+            () ->
+                new BaseSnapshot(
+                    0 /* sequenceNumber */,
+                    1 /* snapshotId */,
+                    null /* parentId */,
+                    0 /* timestampMillis */,
+                    DataOperations.APPEND,
+                    null /* summary */,
+                    1 /* schemaId */,
+                    null /* manifestList */,
+                    "root-manifest.parquet" /* rootManifest */,
+                    null /* rootSizeInBytes */,
+                    10L /* firstRowId */,
+                    5L /* addedRows */,
+                    "key-1" /* keyId */))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage("Root manifest size is required when root manifest is 
set");
+  }
+
+  @TestTemplate
+  void rejectsRootSizeInBytesWithoutRootManifest() {
+    assertThatThrownBy(
+            () ->
+                new BaseSnapshot(
+                    0 /* sequenceNumber */,
+                    1 /* snapshotId */,
+                    null /* parentId */,
+                    0 /* timestampMillis */,
+                    DataOperations.APPEND,
+                    null /* summary */,
+                    1 /* schemaId */,
+                    "ml.avro" /* manifestList */,
+                    null /* rootManifest */,
+                    1024L /* rootSizeInBytes */,
+                    10L /* firstRowId */,
+                    5L /* addedRows */,
+                    "key-1" /* keyId */))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage("Root manifest size is not allowed if root manifest is 
null");
+  }
+
+  @TestTemplate
+  void rejectsNegativeRootSizeInBytes() {

Review Comment:
   Let's conclude on whether to merge the checks or not. Will adjust the test 
if we decide to merge.



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