LucasJavaudin commented on PR #1921:
URL: https://github.com/apache/avro/pull/1921#issuecomment-1286681275
Consider the following enum:
```
enum MyEnum {
Val1,
Val2,
Val3(u64),
}
```
What should be its schema?
I can think of two options.
## A record with two fields
- Field "type" which is an enum with symbols "Val1", "Val2", "Val3".
- Field "value" which is an union.
The union cannot be `["null", "null", "long"]` (or `["string", "string",
"long"]`) because we cannot have the same type twice. Correct?
Can it be just `["null", "long"]` or `[enum(["Val1"]), enum(["Val2"]),
"long"]`? Neither seems intuitive to me.
## An union
With the enum `[enum(["Val1"]), enum(["Val2"]), "long"]`, we can know both
the variant and the data (if any) but this requires to match the `Val3(u64)`
variant to "long", without using the variant name. (Can we match variants by
their order?)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]