-
Notifications
You must be signed in to change notification settings - Fork 44
feat: Support fixed as type for uuid
#339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I think this is ready to merge now |
fixed as type for uuidfixed as type for uuid
|
I've rebased this PR on main |
bbd66d7 to
86b4128
Compare
|
All feedback has been resolved @martin-g |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds official support for the fixed type as an underlying type for the uuid logical type, aligning with Avro 1.12 specification. The changes maintain backward compatibility with the legacy bytes encoding used in versions 0.21.0 and earlier.
Key changes:
- Introduces
UuidSchemaenum to supportstring,fixed, and legacybytesvariants for UUID - Refactors
Schema::Decimalto useInnerDecimalSchemaenum instead ofBox<Schema>, reducing memory overhead - Updates encoding, decoding, validation, and compatibility logic across all UUID variants
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| avro/src/schema.rs | Adds UuidSchema and InnerDecimalSchema enums; updates schema parsing, serialization, and name resolution |
| avro/src/encode.rs | Updates encoding logic for all UUID variants and decimal with new inner schema |
| avro/src/decode.rs | Updates decoding logic for all UUID variants and decimal with new inner schema |
| avro/src/types.rs | Updates value validation and resolution for UUID and decimal variants |
| avro/src/schema_equality.rs | Adds equality comparison for UUID and decimal variant combinations |
| avro/src/schema_compatibility.rs | Implements compatibility checks for UUID variants in reader/writer schemas |
| avro/src/serde/ser_schema.rs | Updates schema-aware serialization for UUID and decimal variants |
| avro/tests/serde_human_readable_true.rs | Renames test and updates from fixed to string UUID type |
| avro/tests/serde_human_readable_false.rs | Updates comment and assertion for fixed UUID encoding |
| avro/src/writer.rs | Updates decimal test cases to use new InnerDecimalSchema |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
All feedback has been resolved @martin-g (including copilot feedback) |
|
Thank you for all the work in reviewing this! |
In Avro 1.12 official support for the
fixedtype was added for the logical typeuuid. avro-rs had a different interpretation of that and would rewrite it to abytestype.To remain compatible with the legacy implementation, avro-rs now supports
string,fixed, andbytes.bytesdoes not match spec, but does allow users to read already encoded data.This is a severe breaking change, although only for people who only use avro-rs (the legacy encoding did not, and still does not work with other languages).
I've also reworked
Schema::Decimalto use a similar setup asSchema::Uuidwhich saves aBoxand does not make the type bigger.