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


##########
core/src/main/java/org/apache/iceberg/TrackedFileStruct.java:
##########
@@ -210,14 +214,27 @@ public long fileSizeInBytes() {
     return fileSizeInBytes;
   }
 
+  void setPartitionType(Types.StructType newPartitionType) {
+    this.partitionType = newPartitionType;
+  }
+
   @Override
   public Integer specId() {
     return specId;
   }
 
   @Override
   public StructLike partition() {
-    return partitionData;
+    if (partitionData == null
+        || partitionType == null
+        || partitionData.getPartitionType().equals(partitionType)) {
+      return partitionData;
+    }
+
+    return new PartitionData(partitionType)

Review Comment:
   We are intentionally not caching this for thread safety, so we pay the cost 
for a few object allocations. Note that in the common case (single spec 
tables), we dont pay this cost. 



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