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


##########
core/src/main/java/org/apache/iceberg/ManifestReader.java:
##########
@@ -101,20 +100,34 @@ private String fileClass() {
 
   protected ManifestReader(
       InputFile file,
+      int specId,
       Map<Integer, PartitionSpec> specsById,
       InheritableMetadata inheritableMetadata,
       FileType content) {
     this.file = file;
     this.inheritableMetadata = inheritableMetadata;
     this.content = content;
 
+    if (specsById != null) {
+      this.spec = specsById.get(specId);
+      Preconditions.checkArgument(
+          spec != null, "Could not find PartitionSpec for specId: %s", specId);
+    } else {
+      this.spec = readPartitionSpec(file);
+    }
+
+    this.fileSchema = new 
Schema(DataFile.getType(spec.partitionType()).fields());
+  }
+
+  private PartitionSpec readPartitionSpec(InputFile inputFile) {

Review Comment:
   This should still pass in `specsById`. There is no reason to change the 
behavior of loading. If the spec is already loaded and defined, it should be 
used rather than parsed.



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