-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework logical type representation (#23)
Resolves #22 **What it does:** - Fixes logical type representation for fixed with logical type (`{"type":{"name":"duration","type":"fixed","size":12},"logicalType":"duration"}` -> `{"type":"fixed", "name":"duration","size":12,"logicalType":"duration"}`) This is what I had originally written but interop tests with `apache-avro` bamboozled me into thinking this is how it was supposed to be. It wasn't, and they later fixed it to make it homogeneous with Java. - Removes support for overly nested types in schema deserialization. This means specifically that the old representation above won't parse. (And similar objects written by versions of `apache-avro` before their fix won't parse.) [This is not supported by the reference Java implementation](https://github.com/apache/avro/blob/06c8b5ddfa3540b466b144503b150e30bf8afc15/lang/java/avro/src/main/java/org/apache/avro/Schema.java#L1830), and it's unspecified and unclear how references would resolve for named overly-nested types. - Reworks logical type representation: `SchemaNode` goes from: ```rust pub enum SchemaNode { /// An Avro type that's not annotated with a logical type RegularType(RegularType), /// An Avro type that is annotated with a logical type LogicalType { /// The key of the [`RegularType`] (in the [`SchemaMut`]) that is /// annotated with this logical type inner: SchemaKey, /// The LogicalType this node is annotated with logical_type: LogicalType, }, } ``` to ```rust pub struct SchemaNode { /// The underlying regular type of this node pub type_: RegularType, /// Logical type that the avro type is annotated with, if any pub logical_type: Option<LogicalType>, } ``` which is simpler to use, and used to be the representation before I got bamboozled into thinking it was not the appropriate representation by interop tests with the broken `apache-avro`.
- Loading branch information
Showing
20 changed files
with
832 additions
and
873 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.