rockwotj opened a new pull request, #827:
URL: https://github.com/apache/iceberg-go/pull/827
## Summary
Fixes #416 and adds a public API for upgrading table format versions.
### Fix: manifest list missing `format-version` metadata (#416)
Per the Iceberg spec, manifest list files are **not required** to carry a
`format-version` metadata key — only manifest files are. Previously
`ReadManifestList` would error if the key was absent, making the library unable
to read tables written by non-Java implementations that strictly follow the
spec.
The fix defaults to format version 1 when the key is absent. This is safe
because:
- V1 tables can only have v1 manifest lists (v2 requires sequence numbers
which don't exist in v1)
- Any v2/v3 manifest list written by a spec-compliant tool will include the
key in practice
- The Avro schema embedded in the file still governs the actual field layout
### Feature: `Transaction.UpgradeFormatVersion`
Adds a public method to upgrade a table's format version via a transaction,
following the pattern of PyIceberg's `transaction.upgrade_table_version()`:
```go
tx := tbl.NewTransaction()
if err := tx.UpgradeFormatVersion(2); err != nil {
return err
}
newTable, err := tx.Commit(ctx)
```
- Downgrading returns an error
- Upgrading to the current version is a no-op
- Both behaviours are enforced by the existing
`MetadataBuilder.SetFormatVersion` logic
## Test plan
- [ ] `TestReadManifestListMissingFormatVersion` — manifest list without
`format-version` key reads successfully, defaulting to v1
- [ ] `TestUpgradeFormatVersionV1ToV2` — transaction produces an
`upgrade-format-version` update
- [ ] `TestUpgradeFormatVersionNoOpWhenSameVersion` — no update staged when
already at target version
- [ ] `TestUpgradeFormatVersionDowngradeErrors` — error returned when
attempting to downgrade
--
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]