You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by at...@apache.org on 2026/08/28 13:38:12 UTC
(iceberg-go) branch main updated: perf(table): reuse field ID scratch in files metadata (#1919)
This is an automated email from the ASF dual-hosted git repository.
laskoviymishka pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-go.git
The following commit(s) were added to refs/heads/main by this push:
new b91740f19 perf(table): reuse field ID scratch in files metadata (#1919)
b91740f19 is described below
commit b91740f196f225cc92be2f953bbb855b99b79872
Author: Minh Vu <vu...@gmail.com>
AuthorDate: Fri Aug 28 15:38:08 2026 +0200
perf(table): reuse field ID scratch in files metadata (#1919)
---
table/inspect_files.go | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/table/inspect_files.go b/table/inspect_files.go
index c014c6c72..6fc98e5b2 100644
--- a/table/inspect_files.go
+++ b/table/inspect_files.go
@@ -533,6 +533,7 @@ type inspectContentFileBuilder struct {
referencedDataFile *array.StringBuilder
contentOffset *array.Int64Builder
contentSize *array.Int64Builder
+ mapFieldIDs []int
}
type inspectPartitionBuilder struct {
@@ -648,7 +649,7 @@ func newInspectContentFileBuilderFromFields(
return out, nil
}
-func (b inspectContentFileBuilder) append(file iceberg.DataFile) error {
+func (b *inspectContentFileBuilder) append(file iceberg.DataFile) error {
b.content.Append(int32(file.ContentType()))
b.filePath.Append(file.FilePath())
b.fileFormat.Append(string(file.FileFormat()))
@@ -663,23 +664,23 @@ func (b inspectContentFileBuilder) append(file iceberg.DataFile) error {
b.recordCount.Append(file.Count())
b.fileSize.Append(file.FileSizeBytes())
columnSizes, keyMetadata, splitOffsets, equalityFieldIDs := dataFileCollections(file)
- if err := appendInspectInt64Map(b.columnSizes, columnSizes); err != nil {
+ if err := appendInspectInt64Map(b.columnSizes, columnSizes, &b.mapFieldIDs); err != nil {
return err
}
valueCounts, nullCounts, nanCounts, lowerBounds, upperBounds := dataFileStats(file)
- if err := appendInspectInt64Map(b.valueCounts, valueCounts); err != nil {
+ if err := appendInspectInt64Map(b.valueCounts, valueCounts, &b.mapFieldIDs); err != nil {
return err
}
- if err := appendInspectInt64Map(b.nullValueCounts, nullCounts); err != nil {
+ if err := appendInspectInt64Map(b.nullValueCounts, nullCounts, &b.mapFieldIDs); err != nil {
return err
}
- if err := appendInspectInt64Map(b.nanValueCounts, nanCounts); err != nil {
+ if err := appendInspectInt64Map(b.nanValueCounts, nanCounts, &b.mapFieldIDs); err != nil {
return err
}
- if err := appendInspectBinaryMap(b.lowerBounds, lowerBounds); err != nil {
+ if err := appendInspectBinaryMap(b.lowerBounds, lowerBounds, &b.mapFieldIDs); err != nil {
return err
}
- if err := appendInspectBinaryMap(b.upperBounds, upperBounds); err != nil {
+ if err := appendInspectBinaryMap(b.upperBounds, upperBounds, &b.mapFieldIDs); err != nil {
return err
}
appendInspectBytes(b.keyMetadata, keyMetadata)
@@ -891,7 +892,7 @@ func inspectInt32Value(value int, name string) (int32, error) {
return int32(value), nil
}
-func appendInspectInt64Map(builder *array.MapBuilder, values map[int]int64) error {
+func appendInspectInt64Map(builder *array.MapBuilder, values map[int]int64, scratch *[]int) error {
if values == nil {
builder.AppendNull()
@@ -906,10 +907,11 @@ func appendInspectInt64Map(builder *array.MapBuilder, values map[int]int64) erro
if !ok {
return fmt.Errorf("map item builder has type %T, want int64", builder.ItemBuilder())
}
- ids := make([]int, 0, len(values))
+ ids := (*scratch)[:0]
for id := range values {
ids = append(ids, id)
}
+ *scratch = ids
sort.Ints(ids)
for _, id := range ids {
key, err := inspectInt32Value(id, "field ID")
@@ -923,7 +925,7 @@ func appendInspectInt64Map(builder *array.MapBuilder, values map[int]int64) erro
return nil
}
-func appendInspectBinaryMap(builder *array.MapBuilder, values map[int][]byte) error {
+func appendInspectBinaryMap(builder *array.MapBuilder, values map[int][]byte, scratch *[]int) error {
if values == nil {
builder.AppendNull()
@@ -938,10 +940,11 @@ func appendInspectBinaryMap(builder *array.MapBuilder, values map[int][]byte) er
if !ok {
return fmt.Errorf("map item builder has type %T, want binary", builder.ItemBuilder())
}
- ids := make([]int, 0, len(values))
+ ids := (*scratch)[:0]
for id := range values {
ids = append(ids, id)
}
+ *scratch = ids
sort.Ints(ids)
for _, id := range ids {
key, err := inspectInt32Value(id, "field ID")