zeroshade commented on code in PR #2637:
URL: https://github.com/apache/iceberg-go/pull/2637#discussion_r4645680068


##########
table/internal/partition_aggregate.go:
##########
@@ -139,15 +140,33 @@ func CoercePartition(values map[int]any, partitionType 
*iceberg.StructType) map[
 
        coerced := make(map[int]any, partitionType.NumFields())
        for i := range partitionType.NumFields() {
-               id := partitionType.Field(i).ID
-               if value, ok := values[id]; ok {
-                       coerced[id] = value
+               field := partitionType.Field(i)
+               if value, ok := values[field.ID]; ok {
+                       coerced[field.ID] = widenPartitionValue(value, 
field.Type)
                }
        }
 
        return coerced
 }
 
+// widenPartitionValue applies the exact int to long and float to double
+// promotions, so values from manifests written before an identity source was
+// promoted aggregate with values written after it.
+func widenPartitionValue(value any, typ iceberg.Type) any {

Review Comment:
   nit, fine as a follow-up: `table/scanner.go` already has 
`widenPromotedPartitionValue` (from #2605), which widens without checking the 
field type, for matching partitions during delete planning. Exporting this 
type-aware helper and using it there would give the promotion rules a single 
home.



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