mattfaltyn opened a new issue, #3109:
URL: https://github.com/apache/iceberg-rust/issues/3109
### Apache Iceberg Rust version
`main` at `5266f7dd3241b6b94843e85f10771d2452c8b874` and release `v0.10.1`
### Describe the bug
Map literals are represented as parallel JSON arrays:
```json
{"keys":["a","b"],"values":[1]}
```
`Literal::try_from_json` currently combines these arrays with
`Iterator::zip`. If their lengths differ, `zip` silently discards the unmatched
keys or values. When this JSON appears in a schema `initial-default` or
`write-default`, deserialization therefore accepts malformed metadata and
stores a different value from the one supplied. This can change values used
during schema evolution or writes without reporting invalid metadata.
The schema conversion also suppresses errors while parsing defaults, so
simply returning an error from the literal parser would otherwise turn an
invalid default into `None`. Invalid defaults should make schema
deserialization fail.
The Java reference implementation rejects map literals unless the key and
value arrays have equal lengths.
### How to reproduce
Parse the JSON above with a `map<string, int>` type, either directly through
`Literal::try_from_json` or as a field default in a serialized schema.
Current result: parsing succeeds with only `{"a": 1}`; the unmatched key is
lost. The inverse case, with more values than keys, also silently drops data.
### Expected behavior
Map literal parsing should return a `DataInvalid` error when the key and
value arrays have different lengths. Schema deserialization should propagate
that error rather than discard the invalid default.
### Willingness to contribute
I am preparing a focused fix with direct literal-parser regressions for both
mismatch directions and an end-to-end schema deserialization regression.
### Additional context
This is a correctness issue, not a security report. I searched open and
closed issues and pull requests for map defaults, JSON literal parsing, unequal
arrays, and key/value length validation; none address this behavior.
--
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]