[prev in list] [next in list] [prev in thread] [next in thread] 

List:       avro-dev
Subject:    [jira] [Created] (AVRO-3759) [Rust] Schema types inconsistency
From:       "Fedor Telnov (Jira)" <jira () apache ! org>
Date:       2023-05-19 6:17:00
Message-ID: JIRA.13536821.1684477014000.10627.1684477020216 () Atlassian ! JIRA
[Download RAW message or body]

Fedor Telnov created AVRO-3759:
----------------------------------

             Summary: [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


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

=C2=A0

```

=C2=A0 =C2=A0 /// A `union` Avro schema.
=C2=A0 =C2=A0 Union(UnionSchema),
=C2=A0 =C2=A0 /// A `record` Avro schema.
=C2=A0 =C2=A0 ///
=C2=A0 =C2=A0 /// The `lookup` table maps field names to their position in =
the `Vec`
=C2=A0 =C2=A0 /// of `fields`.
=C2=A0 =C2=A0 Record {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 name: Name,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 aliases: Aliases,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 doc: Documentation,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 fields: Vec<RecordField>,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 lookup: BTreeMap<String, usize>,
=C2=A0 =C2=A0 },

```

=C2=A0

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 c=
onvenient. 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 use=
rs, as we can't use enum variants as types in Rust. It can also be done wit=
h other schema types as well.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic