rambleraptor opened a new pull request, #1463: URL: https://github.com/apache/iceberg-go/pull/1463
## Why The v3 spec requires readers to load tables whose partition specs or sort orders use transforms the implementation doesn't recognize, and to **ignore those partition fields when filtering** (spec [§Partition Transforms](https://iceberg.apache.org/spec/#partition-transforms): *"All v3 readers are required to read tables with unknown transforms, ignoring them"*). Today `ParseTransform` returns `ErrInvalidTransform` for any unrecognized string, so `UnmarshalJSON` of a partition field or sort field fails outright — a v3 interop hazard and a spec violation. This matches the Java reference, where `Transforms.fromString` returns an `UnknownTransform` for anything it doesn't recognize. ## What changed - **`UnknownTransform`** (`transforms.go`): a placeholder carrying the original transform string. `CanTransform` is permissive, `ResultType` is `string` (matching Java), and `Project` returns `nil` so scan planning never prunes on an unknown partition field. Round-trips verbatim (original casing preserved). - **`ParseTransform`** now returns `UnknownTransform` for unrecognized strings instead of erroring. A *malformed known* transform (`bucket[0]`, `truncate[0]`, width overflow) still errors, matching Java (`Bucket.get`/`Truncate.get` validation). - **Writer restriction**: `validateTransform` rejects committing a partition spec that uses an unknown transform (spec: *"Writers are not allowed to commit data using a partition spec that contains a field with an unknown transform"*). This covers all spec-construction paths (`NewPartitionSpecOpts`, `BindToSchema`, `UpdateSpec.Apply`). The read path (`PartitionSpec.UnmarshalJSON`) sets fields directly and is unaffected. - **Filter expressions stay strict**: an unknown transform in an expression term is still rejected — a filter referencing a transform we can't evaluate must not silently drop semantics. Only partition/sort *metadata* tolerates unknown transforms. - Propagate the `ParseTransform` error in `UpdateSpec.partitionField` instead of discarding it (was `transform, _ := ...`, a latent nil-transform hazard). ## Testing - `ParseTransform`: unrecognized strings (incl. mixed-case) parse to `UnknownTransform` and round-trip; malformed known transforms still error. - Partition field JSON round-trips an unknown transform; building a spec with one is rejected. - Sort orders load unknown transforms (spec requires it) but still reject malformed known ones. - Expression terms reject unknown transforms. - `go test ./...` and `go vet ./...` pass; `golangci-lint` clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
