fallintoplace opened a new pull request, #1894: URL: https://github.com/apache/iceberg-go/pull/1894
## Summary - **Borrow** partition data during scan planning through a read-only `StructLike` view. - Avoid rebuilding a positional `[]any` record for every candidate data file. - Avoid cloning binary partition values on the internal hot path. - Keep public `GetPartitionRecord` behavior defensive and unchanged. - No public API changes. ## Why Scan planning reuses a partition predicate for every candidate data file. Before this change, each evaluation called `GetPartitionRecord`, which allocated a positional record, walked every partition field, and copied binary values. The new internal view looks up partition values by field ID in partition-field order and is used only for the current evaluator call. Its `Set` method is read-only, so the borrowed data cannot be changed through the view. ## Performance Focused `BenchmarkPartitionEvaluator` result for 4,096 files on an Apple M1 Pro: - 1 partition field: about 0.51 ms/op and 295 KB/op -> 0.43 ms/op and 197 KB/op - 8 partition fields: about 0.76 ms/op and 754 KB/op -> 0.42 ms/op and 197 KB/op - 32 partition fields: about 2.84 ms/op and 2.33 MB/op -> 0.52 ms/op and 197 KB/op Each case also drops from 12,288 to 8,192 allocations per benchmark operation. ## Tests - `go test ./...` - `go test -race ./table` - `go vet ./table` - `go test -tags=assert -run='^(TestBuildPartitionEvaluator|TestBorrowedPartitionRecord|TestGetPartitionRecord)' ./table` - `git diff --check` -- 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]
