You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2022/01/19 12:14:00 UTC
[jira] [Commented] (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:comment-tabpanel&focusedCommentId=17478629#comment-17478629 ]
ASF subversion and git services commented on AVRO-3312:
-------------------------------------------------------
Commit e70412bb40d45eb741a5b6986c1b41ac1297add6 in avro's branch refs/heads/avro-3312-use-unsigned-int-for-index from Martin Tzvetanov Grigorov
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=e70412b ]
AVRO-3312: Use u32 instead of i32 for the Enum/Union's index field
Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
> 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)