You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2022/02/05 10:56:00 UTC
[jira] [Commented] (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:comment-tabpanel&focusedCommentId=17487470#comment-17487470 ]
ASF subversion and git services commented on AVRO-3133:
-------------------------------------------------------
Commit c35add7b29b5fab9229d79927a74f327bd56fa70 in avro's branch refs/heads/master from Adam McDevitt
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=c35add7 ]
AVRO-3133: Fix enum resolution to be consistent with Apache Avro specification and the schema compatibility checks (#1381)
* AVRO-3133: add schema compat test
add schema compatibility test to demonstrate that schema compatibility checks are consistent with the avro specification
* AVRO-3133: fix ENUM and FIXED resolvers
fix resolvers for ENUM and FIXED by having then compare unqualified name rather than qualified name
* remove duplicate test
* add missing test cases
* add test for writer with extra enum symbol and reader with default value
* reuse schemas from TestSchemas in TestResolvingGrammarGenerator
this required a change in visibility to two of the static members
* fix formatting
> 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
> Labels: pull-request-available
> Fix For: 1.11.1
>
> Time Spent: 2h 50m
> Remaining Estimate: 0h
>
> 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
> SchemaCompatibility.checkReaderWriterCompatibility _does_ however use unqualified names 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.20.1#820001)