zeroshade commented on code in PR #1822:
URL: https://github.com/apache/iceberg-go/pull/1822#discussion_r3799472688
##########
table/updates.go:
##########
@@ -158,17 +153,20 @@ func (u *Updates) UnmarshalJSON(data []byte) error {
updates = make(Updates, 0, len(rawUpdates))
}
for _, raw := range rawUpdates {
- var baseWire struct {
- Action *string `json:"action"`
- }
- if err := json.Unmarshal(raw, &baseWire); err != nil {
+ var object map[string]json.RawMessage
+ if err := json.Unmarshal(raw, &object); err != nil {
return err
}
- if baseWire.Action == nil {
+ actionValue, ok := object["action"]
Review Comment:
Could we keep action dispatch aligned with the final tagged-struct decode?
This exact map lookup no longer accepts case-insensitive action keys that
`encoding/json` previously accepted. More seriously, for
`{"action":"set-location","ACTION":"unknown","location":"s3://bucket/table"}`,
this lookup dispatches to `setLocationUpdate`, but the later
`json.Unmarshal(raw, upd)` applies case-insensitive struct matching and
overwrites the embedded `ActionName` with `"unknown"`. The result is a concrete
set-location update whose `Action()` reports `unknown`; the merge base rejects
that payload as an unknown action. Please use identical action-key semantics
for dispatch and final decode, with regression tests for mixed-case and
duplicate case-variant keys.
--
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]