rambleraptor commented on code in PR #14266:
URL: https://github.com/apache/iceberg/pull/14266#discussion_r2543410564


##########
core/src/main/java/org/apache/iceberg/SchemaUpdate.java:
##########
@@ -280,8 +301,17 @@ public UpdateSchema updateColumn(String name, 
Type.PrimitiveType newType) {
       return this;
     }
 
+    // If field is listed in source-ids, we need to flag it for promoting date 
-> timestamp.
+    List<PartitionField> partitionFields =
+        this.base != null
+            ? this.base.spec().getFieldsBySourceId(field.fieldId())
+            : Lists.newArrayList();
+
+    boolean isBucketPartitioned =
+        partitionFields.stream().anyMatch(pf -> 
pf.transform().toString().startsWith("bucket["));
+
     Preconditions.checkArgument(
-        TypeUtil.isPromotionAllowed(field.type(), newType),
+        TypeUtil.isPromotionAllowed(field.type(), newType, formatVersion, 
isBucketPartitioned),

Review Comment:
   Bucket is actually called out specifically in the spec for this situation, 
which is why we need to look just for that one.
   <img width="823" height="200" alt="Screenshot 2025-11-19 at 12 08 29 PM" 
src="https://github.com/user-attachments/assets/028cda17-fdc0-4eb5-a42c-b586d6f81da3";
 />
   



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