You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by "Martin Tzvetanov Grigorov (Jira)" <ji...@apache.org> on 2023/05/25 12:08:00 UTC

[jira] [Resolved] (AVRO-3759) [Rust] Schema types inconsistency

     [ https://issues.apache.org/jira/browse/AVRO-3759?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Tzvetanov Grigorov resolved AVRO-3759.
---------------------------------------------
    Fix Version/s: 1.12.0
                   1.11.2
         Assignee: Martin Tzvetanov Grigorov
       Resolution: Fixed

Thanks!

I've merged the PR!

No one expressed concerns here or in the PR comments. I hope it is better now!

> [Rust] Schema types inconsistency
> ---------------------------------
>
>                 Key: AVRO-3759
>                 URL: https://issues.apache.org/jira/browse/AVRO-3759
>             Project: Apache Avro
>          Issue Type: Improvement
>          Components: rust
>            Reporter: Fedor Telnov
>            Assignee: Martin Tzvetanov Grigorov
>            Priority: Major
>             Fix For: 1.12.0, 1.11.2
>
>
> 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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)