Andrea created AVRO-4071:
----------------------------
Summary: Can't redefine classes with 1.12.0
Key: AVRO-4071
URL: https://issues.apache.org/jira/browse/AVRO-4071
Project: Apache Avro
Issue Type: Bug
Affects Versions: 1.12.0
Reporter: Andrea
Hello,
We noticed that with the new 1.12.0 version it's not possible to redefine
classes which are defined in two different avro files.
As we aren't sure if this is a bug or an unintentional feature in the versions
before 1.12.0, we are submitting the issue here but feel free to close it if
this not intended to work. But if it's not intended I'm open to contribute a
fix to get this resolved.
I created a reproducer to show the behavior:
[https://github.com/andreabettich/avro-schema-reproducer]
Failing job to show the error:
[https://github.com/andreabettich/avro-schema-reproducer/actions/runs/11141772156/job/30963342027#step:4:1147]
Based on the error message while generating, it fails at this check:
[https://github.com/apache/avro/blob/80400781a796bc0e90dd8ea1db42234926db33e9/lang/java/avro/src/main/java/org/apache/avro/ParseContext.java#L219]
When checking the values when you run the maven task, the values are the
following:
_schema:_
{code:java}
{
"type" : "record",
"name" : "SharedObject",
"namespace" : "ch.mobi.oss.avro.external"
}
{code}
_alreadyKnownSchema:_
{code:java}
{
"type" : "record",
"name" : "SharedObject",
"namespace" : "ch.mobi.oss.avro.external",
"fields" : [ {
"name" : "number",
"type" : "int"
}, {
"name" : "code",
"type" : "int"
} ]
}{code}
The record schema object is passed from here, which happens before adding the
fields. So I assume that this should actually happend after adding the field,
then it would work (didn't test it yet)
[https://github.com/apache/avro/blob/80400781a796bc0e90dd8ea1db42234926db33e9/lang/java/avro/src/main/java/org/apache/avro/Schema.java#L1865]
Thanks for your work and hope we find a solution for the issue.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)