YuangGao opened a new issue, #2430:
URL: https://github.com/apache/iceberg-rust/issues/2430

   Two complementary bugs in JSON serialization for `Fixed` and `Binary` 
primitive types:
   
   **1. `Literal::try_from_json` panics** 
([literal.rs#L502-L503](https://github.com/apache/iceberg-rust/blob/main/crates/iceberg/src/spec/values/literal.rs#L502-L503)):
   
   ```rust
   (PrimitiveType::Fixed(_), JsonValue::String(_)) => todo!(),
   (PrimitiveType::Binary, JsonValue::String(_)) => todo!(),
   ```
   
   Per the [JSON 
spec](https://iceberg.apache.org/spec/#json-single-value-serialization), these 
should be parsed as hex strings.
   
   **2. `Literal::try_into_json` drops leading zeros** 
([literal.rs#L662-L668](https://github.com/apache/iceberg-rust/blob/main/crates/iceberg/src/spec/values/literal.rs#L662-L668)):
   
   `format!("{x:x}")` (no zero-padding) encodes byte `0x00` as `"0"` and `0x05` 
as `"5"`. So `vec![0x00, 0xff, 0x05]` round-trips to `"0ff5"` instead of 
`"00ff05"`. Should be `{x:02x}`.
   
   Neither path is exercised by the `check_json_serde` round-trip helper at 
[tests.rs#L37](https://github.com/apache/iceberg-rust/blob/main/crates/iceberg/src/spec/values/tests.rs#L37).
 Present on main (0.9.x).
   


-- 
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]

Reply via email to