zeroshade commented on code in PR #1315:
URL: https://github.com/apache/iceberg-go/pull/1315#discussion_r3482957324
##########
schema.go:
##########
@@ -278,6 +278,10 @@ func (s *Schema) UnmarshalJSON(b []byte) error {
return err
}
+ if err := checkDuplicateFieldIDs(nil, aux.Fields); err != nil {
Review Comment:
This catches duplicate *positive* IDs, but missing list/map IDs still slip
through. `checkDuplicateFieldIDs` only records `f.ID > 0` (schema.go:101), and
an omitted list `element-id` or map `key-id`/`value-id` decodes to `0` - so a
schema that omits one of those still unmarshals cleanly (a lone `0` isn't a
duplicate). If the goal is to validate field IDs on unmarshal, it'd be worth
rejecting missing/zero element/key/value IDs too (e.g. decode them as `*int`
and error when absent), while still allowing the negative placeholders used
during construction. Is the broader validation in scope here, or is this
intentionally limited to duplicates?
--
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]