[
https://issues.apache.org/jira/browse/AVRO-3280?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17472980#comment-17472980
]
Ryan Skraba commented on AVRO-3280:
-----------------------------------
This is, in fact, a pretty fuzzy case! The spec _kind of_ says that there is
at least one branch per UNION, since "A union is encoded by first writing an
int value indicating the zero-based position within the union of the schema of
its value." If a valid index must be present, the array can't be empty.
I would rather clarify the spec to be more explicit: the union must not be
empty.
In Java, I believe you can parse a union schema with zero branches, but you
can't use it for reading or writing data.
> What is minimal count of variants in a union?
> ---------------------------------------------
>
> Key: AVRO-3280
> URL: https://issues.apache.org/jira/browse/AVRO-3280
> Project: Apache Avro
> Issue Type: Improvement
> Components: spec
> Reporter: Askar Safin
> Priority: Major
>
> What is minimal count of variants in a union? Spec is not clear on this. I
> think minimal count of variants should be zero. Because many programming
> languages support such unions (for example, Rust supports enums without
> variants)
--
This message was sent by Atlassian Jira
(v8.20.1#820001)