You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Adam McDevitt (Jira)" <ji...@apache.org> on 2021/05/07 16:15:00 UTC
[jira] [Updated] (AVRO-3133) EnumAdjust.resolve should compare
unqualified name rather than full name
[ https://issues.apache.org/jira/browse/AVRO-3133?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Adam McDevitt updated AVRO-3133:
--------------------------------
Description:
Hello
I came across some unexpected errors after a deployment and have been digging into the Apache Avro source code.
I think [this comparison|https://github.com/apache/avro/blob/103477369fcb49a5372f9f5c1353fcd575119287/lang/java/avro/src/main/java/org/apache/avro/Resolver.java#L391] in the Enum resolver should use getName rather than getFullName
The [1.10.2 specification|https://avro.apache.org/docs/1.10.2/spec.html] says, under Schema Resolution:
{code:java}
It is an error if the two schemas do not match.
To match, one of the following must hold:
- both schemas are arrays whose item types match
- both schemas are maps whose value types match
- both schemas are enums whose (unqualified) names match
- both schemas are fixed whose sizes and (unqualified) names match
- both schemas are records with the same (unqualified) name {code}
i.e. unqualified names should be compared, whereas the linked code compares qualified names
Have I misunderstood something here? SchemaCompatibility.checkReaderWriterCompatibility uses unqualified namespaces in its comparisons. See AVRO-2400 and AVRO-2793. From one of the comments on AVRO-2400 you can see that the specification was not always clear on whether it meant qualified or unqualified names.
was:
Hello
I came across some unexpected errors after a deployment and have been digging into the Apache Avro source code.
I think [this comparison|https://github.com/apache/avro/blob/103477369fcb49a5372f9f5c1353fcd575119287/lang/java/avro/src/main/java/org/apache/avro/Resolver.java#L391] in the Enum resolver should use getName rather than getFullName
The [1.10.2 specification|https://avro.apache.org/docs/1.10.2/spec.html] says, under Schema Resolution:
{code:java}
It is an error if the two schemas do not match.
To match, one of the following must hold:
- both schemas are arrays whose item types match
- both schemas are maps whose value types match
- both schemas are enums whose (unqualified) names match
- both schemas are fixed whose sizes and (unqualified) names match
- both schemas are records with the same (unqualified) name {code}
i.e. unqualified names should be compared, whereas the linked code compares qualified names
Have I misunderstood something here? SchemaCompatibility.checkReaderWriterCompatibility uses unqualified namespaces in its comparisons. See AVRO-2400 and AVRO-2793. From this comment you can see that the specification was not always clear on whether it meant qualified or unqualified names.
> EnumAdjust.resolve should compare unqualified name rather than full name
> ------------------------------------------------------------------------
>
> Key: AVRO-3133
> URL: https://issues.apache.org/jira/browse/AVRO-3133
> Project: Apache Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.10.2
> Reporter: Adam McDevitt
> Priority: Major
>
> Hello
> I came across some unexpected errors after a deployment and have been digging into the Apache Avro source code.
> I think [this comparison|https://github.com/apache/avro/blob/103477369fcb49a5372f9f5c1353fcd575119287/lang/java/avro/src/main/java/org/apache/avro/Resolver.java#L391] in the Enum resolver should use getName rather than getFullName
> The [1.10.2 specification|https://avro.apache.org/docs/1.10.2/spec.html] says, under Schema Resolution:
>
> {code:java}
> It is an error if the two schemas do not match.
> To match, one of the following must hold:
> - both schemas are arrays whose item types match
> - both schemas are maps whose value types match
> - both schemas are enums whose (unqualified) names match
> - both schemas are fixed whose sizes and (unqualified) names match
> - both schemas are records with the same (unqualified) name {code}
> i.e. unqualified names should be compared, whereas the linked code compares qualified names
> Have I misunderstood something here? SchemaCompatibility.checkReaderWriterCompatibility uses unqualified namespaces in its comparisons. See AVRO-2400 and AVRO-2793. From one of the comments on AVRO-2400 you can see that the specification was not always clear on whether it meant qualified or unqualified names.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)