Shruthirdy opened a new issue, #2754:
URL: https://github.com/apache/iceberg-go/issues/2754
### Apache Iceberg version
main (development)
### Please describe the bug 🐞
When `UpdateColumn` promotes a column's type, the column's `InitialDefault`
and `WriteDefault` keep the Go type of the old type
### Repro
```go
sc, _ := NewUpdateSchema(txn, true, true).
AddColumn([]string{"value"}, iceberg.PrimitiveTypes.Int32, "", false,
iceberg.Int32Literal(1)).
UpdateColumn([]string{"value"}, ColumnUpdate{
FieldType: iceberg.Optional[iceberg.Type]{Valid: true, Val:
iceberg.PrimitiveTypes.Int64},
}).
Apply()
// value: Type=long, InitialDefault=int32(1), WriteDefault=int32(1)
```
`validateFieldDefaults` then rejects the field (`value of type int does not
match column type long`). The JSON written to metadata is still correct, so
this only affects in-memory users of the schema `Apply()` returns. Promoting an
existing column behaves the same way, because the visitor copies
`InitialDefault` unchanged.
Java converts the defaults to the promoted type.
### Expected
After a promotion, both defaults hold the new type's Go value (here
`int64(1)`).
I started working on a fix for this and will raise PR soon.
--
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]