YuangGao opened a new pull request, #2436:
URL: https://github.com/apache/iceberg-rust/pull/2436
## Which issue does this PR close?
- Closes #2430
## What changes are included in this PR?
Fixes two bugs in `Literal` JSON serialization for `Fixed`/`Binary`:
- `try_from_json`: replace `todo!()` with hex parsing; `Fixed(n)` validates
length, invalid input returns `DataInvalid` instead of panicking.
- `try_into_json`: change `"{x:x}"` to `"{x:02x}"` so bytes `< 0x10` keep
their leading zero (e.g. `[0x00, 0xff, 0x05]` now encodes to `"00ff05"`, not
`"0ff5"`).
The two bugs masked each other — no existing test covered the
`Fixed`/`Binary` JSON path. No new dependencies (uses `u8::from_str_radix`).
## Are these changes tested?
Yes, four new unit tests in `crates/iceberg/src/spec/values/tests.rs`:
- `test_json_serde_binary` — `Binary` round-trip with `"00ff05"` (regression
for the zero-padding bug).
- `test_json_serde_fixed` — `Fixed(4)` round-trip.
- `test_try_from_json_fixed_length_mismatch` — `Fixed(5)` rejects 4-byte hex
input.
- `test_try_from_json_binary_invalid_hex` — non-hex input returns `Err`.
--
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]