Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-3759

[Rust] Schema types inconsistency

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.12.0, 1.11.2
    • rust
    • None

    Description

      That is how Unions and Records are defined in apache-avro Rust crate:

       

      ```

          /// A `union` Avro schema.
          Union(UnionSchema),
          /// A `record` Avro schema.
          ///
          /// The `lookup` table maps field names to their position in the `Vec`
          /// of `fields`.
          Record

      {         name: Name,         aliases: Aliases,         doc: Documentation,         fields: Vec<RecordField>,         lookup: BTreeMap<String, usize>,     }

      ,

      ```

       

      That is inconsistent - one variant is defined with pattern Type(Type) which is VERY convenient(for instance, it allows one to use UnionSchema as type), and the other one(Record) is simply a struct variant, which is not very convenient. My proposition is to hide Record's body in RecordSchema type and use it here - just as you do with union. That would significantly help users, as we can't use enum variants as types in Rust. It can also be done with other schema types as well.

      Attachments

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            ftelnov Fedor Telnov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: