kevinjqliu commented on issue #708:
URL: https://github.com/apache/avro-rs/issues/708#issuecomment-6203374796

   same issue on the write side, adding it here 😄
   
   if a schema uses the same named type twice, it'd be great if avro-rs wrote 
later uses as a reference, like Java's 
[`writeNameRef`](https://github.com/apache/avro/blob/main/lang/java/avro/src/main/java/org/apache/avro/Schema.java).
 `canonical_form()` already does this, but `Serialize` doesn't, and 
`Writer::new` rejects the schema:
   
   ```rust
   schema.canonical_form();          // ✅ {"name":"b","type":"decimal_10_2"}
   serde_json::to_string(&schema)?;  // ❌ repeats the full definition
   Writer::new(&schema, Vec::new()); // ❌ Two named schema defined for same 
fullname
   ```
   
   with both sides, iceberg-rust can drop its custom code for this too 
([`define_once`](https://github.com/apache/iceberg-rust/blob/3bb8167a2c83fe11229b1cf67de0e641c49c8ef6/crates/iceberg/src/avro/schema.rs#L54-L68)).
   


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

Reply via email to