apache / apache/iceberg-go

UpdateSchema: moving a nested column added in the same transaction is silently ignored

Open
#1,685 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
463
Forks
232
Avg merge
2d 11h
Merged PRs (30d)
121

Description

### Apache Iceberg version

main (development)

### Please describe the bug 🐞

When a nested column is added via `AddColumn` / `UnionByNameWith` and then reordered with `MoveFirst`/`MoveBefore`/`MoveAfter` in the same `UpdateSchema`, the move is silently discarded (or fails to resolve a sibling), and the applied schema keeps the field at its default appended position.

Reason for this: `parentID` map, which is seeded once in `initParentID` is never updated. `moveColumn` to `findParentID` therefore returns `TableRootID (-1)`, thus filing under the root struct and dropped by `moveFields` during apply.

Top-level added columns are unaffected.

### Contribution

Will submit a PR for the fix.

Contributor guide

Open the contributing guide

Research direction

Start by tracing initParentID, moveColumn, findParentID, and moveFields in the UpdateSchema implementation. Reproduce an UpdateSchema that adds a nested column and then calls MoveFirst, MoveBefore, or MoveAfter; done means the move resolves the nested parent and the applied schema preserves the requested position.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.