You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "fallintoplace (via GitHub)" <gi...@apache.org> on 2026/10/03 18:51:58 UTC
[PR] perf(rest): avoid unused partition metadata maps [iceberg-go]
fallintoplace opened a new pull request, #2119:
URL: https://github.com/apache/iceberg-go/pull/2119
## What
- Remove unused partition metadata allocations in the REST scan decoder.
## Why
- `NewDataFileBuilder` ignores fixed-size metadata.
- Primitive and null partition values do not need logical-type metadata.
## Implementation
- Pass `nil` for fixed sizes and create the logical-type map only when needed.
- Keep partition values and logical types for data and delete files.
- Add a primitive partition benchmark and coverage for null, fixed, date, decimal, UUID and unpartitioned values.
**Benchmarks:** 1,024 data tasks per operation. Mixed partitions use integer/date/fixed; primitive partitions use integer/string/fixed.
| Partitions | ns/op, base → head | B/op, base → head | allocs/op, base → head |
| --- | ---: | ---: | ---: |
| Mixed | 4,278,023 → 4,173,623 | 5,161,315 → 5,112,099 | 37,894 → 36,870 |
| Primitive | 4,030,529 → 3,434,114 | 4,768,080 → 4,620,560 | 35,846 → 32,774 |
**1,024 fewer allocations** for mixed partitions; **3,072 fewer** for primitive partitions. Times varied between samples; allocation counts were stable.
Go 1.26.3, darwin/arm64, Apple M1 Pro. Median of 7 samples, 1s each, CPU=1. Base `fa5309b3624d5798bde69722b279366bb7f39846`, head `f37470c6e5996fa40274154d272eaaa67f7a0f0e`. The same benchmark file was used on both revisions.
```sh
go test ./catalog/rest -run '^$' -bench '^(BenchmarkDecodeScanTasks|BenchmarkDecodeScanTasksPrimitivePartitions)$/^1024_tasks$' -benchmem -benchtime=1s -count=7 -cpu=1
```
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] perf(rest): avoid unused partition metadata maps [iceberg-go]
Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade merged PR #2119:
URL: https://github.com/apache/iceberg-go/pull/2119
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] perf(rest): avoid unused partition metadata maps [iceberg-go]
Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on code in PR #2119:
URL: https://github.com/apache/iceberg-go/pull/2119#discussion_r4198583354
##########
catalog/rest/scan_task_partition_metadata_bench_test.go:
##########
@@ -0,0 +1,76 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package rest
+
+import (
+ "encoding/json"
+ "fmt"
+ "testing"
+
+ "github.com/apache/iceberg-go"
+)
+
+func BenchmarkDecodeScanTasksPrimitivePartitions(b *testing.B) {
Review Comment:
Nit: both benchmarks in this file are copies of `BenchmarkDecodeScanTasks` in `scan_task_decoder_bench_test.go`, differing only in the spec/partition setup. Folding them into that benchmark as a partition-shape dimension (mixed / primitive / all-null × task count) keeps the decode benchmarks in the file that matches `scan_task_decoder.go`, avoids three copies of the same loop across two files, and keeps base-vs-PR comparisons under one benchmark name.
##########
catalog/rest/scan_task_decoder_test.go:
##########
@@ -740,12 +741,11 @@ func TestPartitionDecodePlanKeepsValuesIndependent(t *testing.T) {
assert.Equal(t, []byte("ABCD"), second[1002])
firstLogical[1001] = "changed"
assert.NotContains(t, secondLogical, 1001)
- firstFixed[1002] = 99
- assert.NotContains(t, secondFixed, 1002)
+ assert.Nil(t, secondLogical)
Review Comment:
Nit: with the lazy map, `secondLogical` is always nil for this input (its date is `null`), so mutating `firstLogical` and then checking `NotContains` can't detect aliasing anymore and is redundant with the `assert.Nil` below. Asserting the first map's contents is a more useful check here:
```suggestion
assert.Equal(t, map[int]string{1001: atype.Date}, firstLogical)
assert.Nil(t, secondLogical)
```
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org