perf(table): avoid cloning schema history for position_deletes partition IDs - #1920
Conversation
587588b to
29e119b
Compare
zeroshade
left a comment
There was a problem hiding this comment.
The history-independent allocation is a substantial improvement, but the new starting-point calculation can produce duplicate or out-of-range field IDs.
Blocking — Guard synthetic field-ID allocation (table/inspect_position_deletes.go:817–831)
metadata.LastColumnID()+1 is used without validating it against the current schema or the signed 32-bit field-ID boundary.
I reproduced two regressions:
-
The metadata parser accepts a schema field with ID
2andlast-column-id: 1. This change assigns the partition field ID2, after whichPositionDeletesSchemapanics:invalid schema: multiple fields for id 2: x and xThe merge-base implementation assigns an unused ID and succeeds.
-
With
LastColumnID() == iceberg.MaxStructFieldIDand 193 active partition fields, the final generated ID is2147483648, outside Iceberg’s signed 32-bit field-ID range. This also wraps on 32-bit platforms.
Please keep the fast path but seed collision checks from the current schema and make allocation overflow-safe. If the range above LastColumnID is exhausted, fall back to low unused IDs or return a structured error. Regression coverage should include both cases above.
This review was drafted by an AI-assisted tool and confirmed by an Iceberg Go maintainer. After you've addressed the points above and pushed an update, an Iceberg Go maintainer — a real person — will take the next look at the PR. The findings cite the project's review criteria; if you think one of them is mis-applied, please reply on the PR and a maintainer will weigh in.
More on how Iceberg Go handles maintainer review:
CONTRIBUTING.md.
29e119b to
f5052e8
Compare
What changed
LastColumnID() + 1.Benchmark
go test ./table -run '^$' -bench '^BenchmarkPositionDeletesPartitionType/schemas=(1|16|128|1024)/fields=64$' -benchmem -count=5 -benchtime=1sThe optimized path is effectively flat as schema history grows.
Tests
LastColumnID().