You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by ze...@apache.org on 2026/08/17 19:21:14 UTC
(iceberg-go) branch main updated: fix(deps): bump twmb/avro to v1.8.0 and adapt to its API changes (#1843)
This is an automated email from the ASF dual-hosted git repository.
zeroshade 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 c2105090c fix(deps): bump twmb/avro to v1.8.0 and adapt to its API changes (#1843)
c2105090c is described below
commit c2105090c9e2e1c9b13f483dfe93a113b83e31de
Author: Travis Bischel <tr...@gmail.com>
AuthorDate: Mon Aug 17 13:21:09 2026 -0600
fix(deps): bump twmb/avro to v1.8.0 and adapt to its API changes (#1843)
v1.8.0 changes Schema.Root() to return *SchemaNode rather than SchemaNode,
which breaks four value-context uses here. Field access auto-derefs, so the
fix is a deref at the sites that pass or assign the node by value.
It also changes what integral JSON metadata decodes to. Root() now preserves
numeric precision, so a field's "field-id" property comes back as int64
where it was float64 before (integers above 2^53 previously rounded through
float64). schemaFieldID matched only int and float64, so under v1.8.0 it
returned false for every field.
That failure is silent rather than loud: getFieldIDMap ends up with an empty
map, avroEncodePartitionData iterates nothing, and partition values are
written to the manifest as null. The header schema is still correct, and the
read path drops the same keys for the same reason, so nothing errors --
partition data is just lost. Pinned by the two existing tests that catch it,
TestDataFileStatisticsDecimalPartitionManifestRoundTrip and
TestCollectDeadPositionDeletesPartitioned.
Accepting int64 alongside int and float64 keeps this working across both
avro versions.
Signed-off-by: Travis Bischel <tr...@gmail.com>
---
go.mod | 2 +-
go.sum | 4 ++--
internal/avro_schemas.go | 6 +++---
manifest.go | 4 +++-
4 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/go.mod b/go.mod
index 7c703c01b..9fa59dacb 100644
--- a/go.mod
+++ b/go.mod
@@ -47,7 +47,7 @@ require (
github.com/stretchr/testify v1.11.1
github.com/substrait-io/substrait-go/v8 v8.1.1
github.com/testcontainers/testcontainers-go/modules/compose v0.44.0
- github.com/twmb/avro v1.7.2
+ github.com/twmb/avro v1.8.0
github.com/twmb/murmur3 v1.1.8
github.com/twpayne/go-geom v1.6.1
github.com/uptrace/bun v1.2.18
diff --git a/go.sum b/go.sum
index 60fc1b9c7..f5b8b639b 100644
--- a/go.sum
+++ b/go.sum
@@ -631,8 +631,8 @@ github.com/transparency-dev/formats v0.1.1 h1:4bVHJc+KdBgpA1OJD1yjI+g0i5Z1graCpp
github.com/transparency-dev/formats v0.1.1/go.mod h1:qtZ8goRuJ8FTBG9c9+Bj0rn2rUG7eG/AUTkr+Aw3jFw=
github.com/transparency-dev/merkle v0.0.2 h1:Q9nBoQcZcgPamMkGn7ghV8XiTZ/kRxn1yCG81+twTK4=
github.com/transparency-dev/merkle v0.0.2/go.mod h1:pqSy+OXefQ1EDUVmAJ8MUhHB9TXGuzVAT58PqBoHz1A=
-github.com/twmb/avro v1.7.2 h1:cmrEBRSbELRqsg/dRkQvVWuOaR2EfGifHIt/2iJ9lfI=
-github.com/twmb/avro v1.7.2/go.mod h1:X0fT1dY2xcbV4YuCE4mYro+qljHl4kUF5uA/2z1rgSk=
+github.com/twmb/avro v1.8.0 h1:UMWLg+nH4P3yad5Om7yFSohYLy2RG1s7BcFFiOvmK9Q=
+github.com/twmb/avro v1.8.0/go.mod h1:X0fT1dY2xcbV4YuCE4mYro+qljHl4kUF5uA/2z1rgSk=
github.com/twmb/murmur3 v1.1.8 h1:8Yt9taO/WN3l08xErzjeschgZU2QSrwm1kclYq+0aRg=
github.com/twmb/murmur3 v1.1.8/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ=
github.com/twpayne/go-geom v1.6.1 h1:iLE+Opv0Ihm/ABIcvQFGIiFBXd76oBIar9drAwHFhR4=
diff --git a/internal/avro_schemas.go b/internal/avro_schemas.go
index 720f4be41..fe6c87dd0 100644
--- a/internal/avro_schemas.go
+++ b/internal/avro_schemas.go
@@ -39,7 +39,7 @@ func mustSchema(n avro.SchemaNode) *avro.Schema {
}
func NullableSchema(schema *avro.Schema) *avro.Schema {
- return mustSchema(NullableNode(schema.Root()))
+ return mustSchema(NullableNode(*schema.Root()))
}
var requiredLength = [...]int{
@@ -423,7 +423,7 @@ func newDataFileSchema(partitionType *avro.Schema, version int) (*avro.Schema, e
node := schema.Root()
node.Fields = append(slices.Clone(node.Fields), avro.SchemaField{
Name: "partition",
- Type: partitionType.Root(),
+ Type: *partitionType.Root(),
Props: map[string]any{"field-id": 102},
})
@@ -460,7 +460,7 @@ func NewManifestEntrySchema(partitionType *avro.Schema, version int) (*avro.Sche
node := schema.Root()
node.Fields = append(slices.Clone(node.Fields), avro.SchemaField{
Name: "data_file",
- Type: dfschema.Root(),
+ Type: *dfschema.Root(),
Props: map[string]any{"field-id": 2},
})
diff --git a/manifest.go b/manifest.go
index 4bee8331e..73f1d13e5 100644
--- a/manifest.go
+++ b/manifest.go
@@ -469,7 +469,7 @@ func getFieldIDMap(sc *avro.Schema) dataFileFieldMaps {
decimalScales := make(map[int]int)
unknownFieldIDs := make(map[int]struct{})
- entryField := getField(root, "data_file")
+ entryField := getField(*root, "data_file")
partitionField := getField(entryField.Type, "partition")
for _, field := range partitionField.Type.Fields {
@@ -1013,6 +1013,8 @@ func schemaFieldID(f avro.SchemaField) (int, bool) {
switch v := f.Props["field-id"].(type) {
case int:
return v, true
+ case int64:
+ return int(v), true
case float64:
return int(v), true
}