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 b9a9bd92e test(view): check identifier field IDs are copied end to end
(#2711)
b9a9bd92e is described below
commit b9a9bd92e4d89ef9b2619a65d018e9e9905d456c
Author: Revanth <[email protected]>
AuthorDate: Thu Nov 26 02:43:21 2026 -0600
test(view): check identifier field IDs are copied end to end (#2711)
---
types.go | 9 ++++++---
view/metadata_test.go | 3 +++
website/src/releases.md | 2 +-
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/types.go b/types.go
index cd94fb315..2b5d4e93e 100644
--- a/types.go
+++ b/types.go
@@ -513,7 +513,8 @@ func (s *StructType) Fields() []NestedField { return
slices.Clone(s.fields) }
// which Go fields are exported.
// MarshalJSON has a value receiver on purpose: [Schema.AsStruct] returns a
-// StructType value, which must not encode as {}.
+// StructType value, which must not encode as {}. The other methods keep
+// pointer receivers, so only *StructType implements Type.
func (s StructType) MarshalJSON() ([]byte, error) {
fields := s.fields
if fields == nil {
@@ -592,7 +593,8 @@ func (l *ListType) Element() Type { return l.element }
func (l *ListType) ElementRequired() bool { return l.elementRequired }
// MarshalJSON has a value receiver on purpose: a ListType value, such as one
-// held in a map, must not encode as {}.
+// held in a map, must not encode as {}. The other methods keep pointer
+// receivers, so only *ListType implements Type.
func (l ListType) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
Type string `json:"type"`
@@ -693,7 +695,8 @@ func (m *MapType) ValueType() Type { return m.valueType }
func (m *MapType) ValueRequired() bool { return m.valueRequired }
// MarshalJSON has a value receiver on purpose: a MapType value, such as one
-// held in a map, must not encode as {}.
+// held in a map, must not encode as {}. The other methods keep pointer
+// receivers, so only *MapType implements Type.
func (m MapType) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
Type string `json:"type"`
diff --git a/view/metadata_test.go b/view/metadata_test.go
index a15580a91..ed127422d 100644
--- a/view/metadata_test.go
+++ b/view/metadata_test.go
@@ -990,6 +990,8 @@ func TestMetadataGettersReturnDefensiveCopies(t *testing.T)
{
currentSchema := md.CurrentSchema()
currentSchema.ID = 99
+ identifierIDs := currentSchema.IdentifierFieldIDs()
+ identifierIDs[0] = 99
schemas := md.Schemas()
schemas[0].ID = 98
@@ -1009,6 +1011,7 @@ func TestMetadataGettersReturnDefensiveCopies(t
*testing.T) {
assert.Equal(t, "select * from ns.tbl",
md.CurrentVersion().Representations[0].SQL)
assert.Equal(t, "accounting", md.CurrentVersion().DefaultNamespace[0])
assert.Equal(t, 0, md.CurrentSchema().ID)
+ assert.Equal(t, []int{1}, md.CurrentSchema().IdentifierFieldIDs())
assert.Equal(t, 0, md.Schemas()[0].ID)
assert.Equal(t, 0, md.SchemasByID()[0].ID)
assert.Equal(t, int64(1), md.VersionLog()[0].VersionID)
diff --git a/website/src/releases.md b/website/src/releases.md
index 50b2d7500..c73539af1 100644
--- a/website/src/releases.md
+++ b/website/src/releases.md
@@ -77,7 +77,7 @@ Per-release notes (highlights, breaking changes,
contributors) are published on
- `MapType.KeyID`, `KeyType`, `ValueID`, `ValueType` and `ValueRequired`
become `KeyID()`, `KeyType()`, `ValueID()`, `ValueType()` and `ValueRequired()`.
- `Schema.IdentifierFieldIDs` is unexported too and becomes
`IdentifierFieldIDs()`, which returns a copy. Set the IDs with
`NewSchemaWithIdentifiers`, which keeps its own copy of the slice it is given.
- Pointers to these types and `Schema` encode to the same JSON as before.
Values of these types, such as the result of `Schema.AsStruct()`, now encode
like pointers instead of a partial form without `"type"`.
+ Pointers to these types and `Schema` encode to the same JSON as before.
Values of these types, such as the result of `Schema.AsStruct()`, now encode
like pointers instead of a partial form without `"type"`, in which list and map
values also dropped their element, key and value types.
- **`io.StatIO.Stat` accepts a context.** The method now takes a
`context.Context` before the path, so custom `StatIO` implementations and
callers must pass the operation context.
- **Commits retry conflicts by default.** `commit.retry.num-retries` now
defaults to `4`, as in Java and PyIceberg, so `Commit` refreshes and replays a
conflicting commit up to four times before returning `ErrCommitFailed`. Set it
to `0` to keep failing on the first conflict. `table.CommitNumRetriesDefault`
changes from `0` to `4`.
- **The first `Delete` on a v3 table upgraded from v2 can fail with
`ErrCommitFailed`.** A merge-on-read `Delete` that gives a data file its first
deletion vector now folds that file's v2 position deletes into the vector, so
those deletes no longer reappear after the upgrade, and drops the file-scoped
v2 position delete files in the same commit. Like any commit that removes
delete files, it is not replayed: if another writer commits first, it returns
`ErrCommitFailed` instead of refreshi [...]