You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Ryan Skraba (Jira)" <ji...@apache.org> on 2022/07/01 06:01:00 UTC

[jira] [Created] (AVRO-3561) [Python] Schema resolution fails with equivalent names

Ryan Skraba created AVRO-3561:
---------------------------------

             Summary: [Python] Schema resolution fails with equivalent names
                 Key: AVRO-3561
                 URL: https://issues.apache.org/jira/browse/AVRO-3561
             Project: Apache Avro
          Issue Type: Bug
            Reporter: Ryan Skraba


These schemas are equivalent and should be fully compatible:
{code:json}
{"type": "record", "name": "Record1", "fields": [{"type": ["null", {"type": "array", "items": {"type": "record", "name": "InnerRecord1", "namespace": "ns2", "fields": [{"type": "int", "name": "a"}]}}], "name": "f1"}]}

{"type": "record", "name": "Record1", "fields": [{"type": ["null", {"type": "array", "items": {"type": "record", "name": "ns2.InnerRecord1", "fields": [{"type": "int", "name": "a"}]}}], "name": "f1"}]}{code}
(Note the way the full name is specified in the {*}innerRecord1{*})

Currently schema compatibility between the two fails because the name attributes don't match. In this case the fullnames are {_}identical{_}.

In any case, the specification only needs to match the unqualified name.  The following schema is not equivalent but should be compatible.  Note the change in the namespace.
{code:json}
 {"type": "record", "name": "Record1", "fields": [{"type": ["null", {"type": "array", "items": {"type": "record", "name": "ns3.InnerRecord1", "fields": [{"type": "int", "name": "a"}]}}], "name": "f1"}]}{code}
It appears that the compatibility logic assumes that [the name attribute has been unqualified|https://github.com/apache/avro/blob/6dc6055e04188919886bd1b4ed95a7c6f4fac23e/lang/py/avro/compatibility.py#L376-L378].



--
This message was sent by Atlassian Jira
(v8.20.10#820010)