rdblue commented on code in PR #18021:
URL: https://github.com/apache/iceberg/pull/18021#discussion_r3972795396


##########
core/src/main/java/org/apache/iceberg/V4ManifestReader.java:
##########
@@ -186,9 +199,30 @@ static class Builder {
     private Schema requestedProjection = null;
     private ScanMetrics scanMetrics = ScanMetrics.noop();
 
-    private Builder(InputFile file, Map<Integer, PartitionSpec> specsById, 
String tableLocation) {
+    private Builder(
+        ManifestFile manifest,
+        FileIO io,
+        Map<Integer, PartitionSpec> specsById,
+        String tableLocation) {
       Preconditions.checkArgument(tableLocation != null, "Invalid table 
location: null");
-      this.file = file;
+      int formatVersion = manifest.formatVersion();
+      Preconditions.checkArgument(
+          formatVersion == SUPPORTED_FORMAT_VERSION,
+          "Cannot read manifest with format version %s: only %s is supported",
+          formatVersion,
+          SUPPORTED_FORMAT_VERSION);
+      if (manifest.content() == ManifestContent.DELETES) {
+        throw new UnsupportedOperationException(
+            "Cannot read a delete manifest: " + manifest.path());

Review Comment:
   v4 manifests cannot be delete files. I think this should be an 
`IllegalStateException` because it indicates that the file is malformed, with 
format-version=4 and content=deletes.



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