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


##########
core/src/main/java/org/apache/iceberg/V4ManifestReader.java:
##########
@@ -153,6 +154,12 @@ private TrackedFile applyInheritance(TrackedFile file) {
       }
     }
 
+    Integer specId = file.specId();
+    PartitionSpec spec = specId != null ? specsById.get(specId) : null;
+    if (file instanceof TrackedFileStruct) {
+      ((TrackedFileStruct) file).setPartitionType(spec != null ? 
spec.partitionType() : null);

Review Comment:
   Removed. Doing cast directly. 



##########
core/src/main/java/org/apache/iceberg/V4ManifestReader.java:
##########
@@ -153,6 +154,12 @@ private TrackedFile applyInheritance(TrackedFile file) {
       }
     }
 
+    Integer specId = file.specId();
+    PartitionSpec spec = specId != null ? specsById.get(specId) : null;
+    if (file instanceof TrackedFileStruct) {

Review Comment:
   I think the method was renamed to `inheritance` recently, I should have 
changed it after rebasing. Moved it out to a `projectPartition` transform. 



##########
core/src/main/java/org/apache/iceberg/TrackedFileStruct.java:
##########
@@ -142,7 +145,8 @@ private TrackedFileStruct(TrackedFileStruct toCopy, 
Set<Integer> statsIds) {
     this.recordCount = toCopy.recordCount;
     this.fileSizeInBytes = toCopy.fileSizeInBytes;
     this.specId = toCopy.specId;
-    this.partitionData = toCopy.partitionData != null ? 
toCopy.partitionData.copy() : null;
+    this.partitionData = copyOf(toCopy.partitionData);

Review Comment:
   I did it this way because the getter method on the copied file will return 
the stored union tuple (for writes).  I have changed it such that the two 
partition fields are collapsed into a single `StructLike` partition plus a 
transient `StructProjection`. The copy now materializes just the projected 
tuple via a `StructLikeUtil.copy()`



##########
core/src/main/java/org/apache/iceberg/TrackedFile.java:
##########
@@ -169,7 +169,10 @@ static Schema readSchema(Types.StructType partitionType, 
Types.StructType conten
   /** Returns the ID of the partition spec used to partition this file, or 
null. */
   Integer specId();
 
-  /** Returns partition for this file as a {@link StructLike}, or null. */
+  /**
+   * Returns the partition for this file as a {@link StructLike} in the field 
order of the file's

Review Comment:
   Done. reworded to "Returns the partition for this file as a struct with the 
partition spec's output type, or null."



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