rambleraptor opened a new pull request, #2076: URL: https://github.com/apache/iceberg-go/pull/2076
This ports Java's `TypeUtil.assignFreshIds(Schema schema, Schema baseSchema, NextID nextId)` (backed by `AssignFreshIds.idFor`). Fields whose full column name exists in `base` reuse that ID, and every other field gets a fresh ID from `nextID`. Names are matched case-sensitively, including nested paths such as `location.lat`, `tags.element` and `props.key`. Identifier field IDs are remapped too. `AssignFreshSchemaIDs(sc, nextID)` now delegates to `AssignFreshSchemaIDsWithBase(sc, nil, nextID)`, so its behavior doesn't change. **Why:** declarative clients have to write this themselves when they take a desired schema and commit it as a new table schema. Getting it wrong either renumbers existing columns or reuses a retired column's ID (see #538). Java uses this exact call in `TableMetadata.buildReplacement`, with the current schema as the base and `lastColumnId::incrementAndGet` supplying new IDs. The Terraform provider (apache/terraform-provider-iceberg) currently has its own version of this logic that I'd like to replace. Tests cover: - ID reuse across reordered top-level, nested struct, list and map fields - new fields only drawing IDs from `nextID`, so a dropped column's ID is not reused - identifier field remapping - case-sensitive matching - parity with `AssignFreshSchemaIDs` when `base` is nil AI Disclosure: Claude built this for me under my supervision, as part of upstreaming functionality from the Terraform provider. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
