[
https://issues.apache.org/jira/browse/AVRO-3312?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Martin Tzvetanov Grigorov updated AVRO-3312:
--------------------------------------------
Description:
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).
was:
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).
> Rust: Use u32 instead of i32 for the Enum/Union 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)