Revanth14 opened a new pull request, #2655:
URL: https://github.com/apache/iceberg-go/pull/2655
## Problem
The v1 immutability work in #2062 still has exported fields on the nested
types. Callers can build `StructType`, `ListType` and `MapType` with keyed
literals, or assign the fields of one that a schema already shares. The same is
true of `Schema.IdentifierFieldIDs`.
## Fix
- Unexport the fields of `StructType`, `ListType` and `MapType`. Reads go
through methods named after the old fields: `ElementID()`, `Element()`,
`ElementRequired()`, `KeyID()`, `KeyType()`, `ValueID()`, `ValueType()` and
`ValueRequired()`. `FieldList` uses the existing `Fields()`, `NumFields()` and
`Field(i)`.
- Unexport `Schema.IdentifierFieldIDs`. `IdentifierFieldIDs()` returns a
copy, and `NewSchemaWithIdentifiers` keeps its own copy of the slice it is
given. `PartitionField.SourceIDs` and `SortField.SourceIDs` stay exported, as
agreed on #2062.
- `MarshalJSON` on the three nested types now has a value receiver. Without
that, unexporting the fields would make a value such as `Schema.AsStruct()`
marshal as `{}`.
- A rewrite tool that resolves Go types renamed 299 references inside
package `iceberg` and turned 133 reads in other packages into method calls. The
JSON format is unchanged because the marshalers write each key explicitly.
## Testing
- Tests that wrote through these fields either moved into package `iceberg`
(`schema_clone_internal_test.go`, `types_internal_test.go`) or now build the
changed types with the constructors (`TestPhysicalSchemaKey*`).
- The `table` and `view` clone tests now check values that are still shared,
and the `view` test also checks that the clone holds its own nested types. Both
fail if the clone is removed.
- New `TestSchemaIdentifierFieldIDsAreCopied` and
`TestNestedTypeValuesMarshalLikePointers`.
- No tests were removed.
## Context
Part of #2062.
--
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]