UpgradeFormatVersion fails when last-column-id is lower than an existing field ID
Maintainers usually reply within 2 days
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start by reading the format-version upgrade path through MetadataBuilderFromBase, SetFormatVersion, and validateLastColumnID, then compare how #2453 applies columnIDFloor in NewUpdateSchema and AddSchema. The repro uses ExampleTableMetadataV2 with last-column-id 2 while field z has ID 3. Done when upgrading to version 3 succeeds and raises last-column-id to 3, with a regression test for that metadata.
Written by the indexing model from the issue text.
Description
Apache Iceberg version
main (development)
Please describe the bug 🐞
If a table's last-column-id is lower than a field ID already used in its schemas, UpgradeFormatVersion fails, while other updates on the same table work.
#2453 fixed this for schema updates: NewUpdateSchema and AddSchema now take the max of last-column-id and every schema's highest field ID (columnIDFloor). MetadataBuilderFromBase still copies last-column-id from metadata as is, and SetFormatVersion checks that value in validateLastColumnID, so the upgrade is rejected.
Repro
Same metadata as #2452: ExampleTableMetadataV2 with last-column-id changed from 3 to 2 (field z has ID 3).
data := strings.Replace(table.ExampleTableMetadataV2,
`"last-column-id": 3`, `"last-column-id": 2`, 1)
meta, _ := table.ParseMetadataString(data)
tbl := table.New([]string{"db", "t"}, meta, "", nil, nil)
txn := tbl.NewTransaction()
err := txn.UpgradeFormatVersion(3)
fmt.Println(err)
Output:
invalid metadata: last-column-id 2 is less than the highest field ID 3 in schemas
Expected:
The upgrade succeeds and last-column-id is raised to 3, as schema updates already do since #2453.
I'd like to work on this issue.
- Dominant language
- Go
- Stars
- 477
- Forks
- 262
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 303
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/iceberg-go
-
UpdateSchema.BuildUpdates should select newly added schemas with schema-id: -1Possibly taken @nisan1101 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
apache/iceberg-go#2586 · 1 comment ·
Maintainers usually reply within 2 days
-
RowDelta: concurrent dv conflict returns a plain errorPossibly taken @akritishakya claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
apache/iceberg-go#2491 · 1 comment ·
Maintainers usually reply within 2 days
-
fix(cli): return a clear error for an unknown --output typeMay be free again @eneskeles claimed this 43 days ago, and no pull request is open. Opengood first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
apache/iceberg-go#2082 · 2 comments · 1 assignee ·
Maintainers usually reply within 2 days
-
TruncateTransform splits multi-byte UTF-8 characters, producing invalid string bounds in manifestsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
apache/iceberg-go#2063 · 3 comments ·
Maintainers usually reply within 2 days
-
rest: a 406 response is not reported as ErrNotImplementedPossibly taken @slachiewicz claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
apache/iceberg-go#2587 ·
Maintainers usually reply within 2 days
All issues in apache/iceberg-go
Similar issues
-
area: interop area: sip-core v3
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
fonoster/routr#705 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
deadfin-org/deadfin#35 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
enhancement priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
labmonkeys-space/nl6#1037 ·
Maintainers usually reply within 1 day
-
Setup Guide Go tab: say it needs Go 1.26 (the unversioned go get pulls OpenTelemetry Go v1.47.0)Openenhancement follow-up
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day