You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Steven Aerts (Jira)" <ji...@apache.org> on 2020/05/11 09:05:00 UTC
[jira] [Created] (AVRO-2830) Union with aliases fail on 'Duplicate
in union'
Steven Aerts created AVRO-2830:
----------------------------------
Summary: Union with aliases fail on 'Duplicate in union'
Key: AVRO-2830
URL: https://issues.apache.org/jira/browse/AVRO-2830
Project: Apache Avro
Issue Type: Bug
Components: java
Affects Versions: 1.9.2
Reporter: Steven Aerts
When evolving an avro scheme I think it should be possible to merge multiple records in to one.
So with this union as writer type:
{code:java}
[ {
"type" : "record",
"name" : "A",
"fields" : [ { "name" : "a", "type" : "boolean" } ]
}, {
"type" : "record",
"name" : "B",
"fields" : [ { "name" : "b", "type" : "boolean" } ]
} ]
{code}
I want to ready it with the following reader schema:
{code:java}
[ {
"type" : "record",
"name" : "B",
"aliases" : [ "A" ],
"fields" : [
{ "name" : "a", "type" : "boolean", "default" : true},
{ "name" : "b", "type" : "boolean", "default" : true}
]
} ]
{code}
This however generates the following stacktrace when trying to read it:
{code:java}
org.apache.avro.AvroRuntimeException: Duplicate in union:B
at org.apache.avro.Schema$UnionSchema.<init>(Schema.java:1165)
at org.apache.avro.Schema.createUnion(Schema.java:224)
at org.apache.avro.Schema.applyAliases(Schema.java:1846)
at org.apache.avro.Schema.applyAliases(Schema.java:1802)
at org.apache.avro.Resolver.resolve(Resolver.java:62)
at org.apache.avro.Resolver.resolve(Resolver.java:69)
at org.apache.avro.io.parsing.ResolvingGrammarGenerator.generate(ResolvingGrammarGenerator.java:64)
at org.apache.avro.io.ResolvingDecoder.resolve(ResolvingDecoder.java:84)
{code}
We have a pull request coming up to fix this issue.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)