You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Martin Tzvetanov Grigorov (Jira)" <ji...@apache.org> on 2022/01/19 11:59:00 UTC
[jira] [Updated] (AVRO-3312) Rust: Use u32 instead of i32 for the Enum/Union's index field
[ https://issues.apache.org/jira/browse/AVRO-3312?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martin Tzvetanov Grigorov updated AVRO-3312:
--------------------------------------------
Summary: Rust: Use u32 instead of i32 for the Enum/Union's index field (was: Rust: Use u32 instead of i32 for the Enum/Union index field)
> Rust: Use u32 instead of i32 for the Enum/Union's index field
> -------------------------------------------------------------
>
> Key: AVRO-3312
> URL: https://issues.apache.org/jira/browse/AVRO-3312
> Project: Apache Avro
> Issue Type: Improvement
> Components: rust
> Reporter: Martin Tzvetanov Grigorov
> Assignee: Martin Tzvetanov Grigorov
> Priority: Major
>
> Currently Rust's Value::Enum and Value::Union use i32 (i.e. signed int) for their index [fields|https://github.com/apache/avro/blob/49c6e1067c937d066503be9c7f4032fb03f67474/lang/rust/src/types.rs#L61-L74]:
> {code}
> /// An `enum` Avro value.
> ///
> /// An Enum is represented by a symbol and its position in the symbols list
> /// of its corresponding schema.
> /// This allows schema-less encoding, as well as schema resolution while
> /// reading values.
> Enum(i32, String),
> /// An `union` Avro value.
> ///
> /// A Union is represented by the value it holds and its position in the type list
> /// of its corresponding schema
> /// This allows schema-less encoding, as well as schema resolution while
> /// reading values.
> Union(i32, Box<Value>),
> {code}
> Since they cannot be negative it would be better to change them to u32 (unsigned int).
--
This message was sent by Atlassian Jira
(v8.20.1#820001)