You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Chanzo Bryan (Jira)" <ji...@apache.org> on 2024/04/23 05:21:00 UTC

[jira] [Created] (AVRO-3979) Python SchemaCompatibility doesn't set location properly for type mismatch with writer unions

Chanzo Bryan created AVRO-3979:
----------------------------------

             Summary: Python SchemaCompatibility doesn't set location properly for type mismatch with writer unions
                 Key: AVRO-3979
                 URL: https://issues.apache.org/jira/browse/AVRO-3979
             Project: Apache Avro
          Issue Type: Bug
          Components: python
    Affects Versions: 1.11.3, 1.12.0, 1.11.4
            Reporter: Chanzo Bryan


When a reader schema has a type mismatch with a writer schema where the writer schema type is a union, the location information for the schema compatibility is lost in Python. This was fixed in Java as a part of AVRO-3612.

Given a reader record schema with _int_ field {_}a{_}:

 
{code:java}
{
  "type": "record",
  "name": "Record1",
  "fields": [
    {
      "name": "a",
      "type": "int"
    }
  ]
}{code}
 

 

and a writer record schema with an _optional int_ (union of _int_ and {_}null{_}) field {_}a{_}:

 
{code:java}
{
  "type": "record",
  "name": "Record1",
  "fields": [
    {
      "name": "a",
      "type": ["null", "int"],
      "default": "null"
    }
  ]
} {code}
 

 

I would expect to get the follow message and location on invoking {_}get_compatibility(reader, writer){_}:

 
{code:java}
message:  "reader type: int not compatible with writer type: null"
location: "/fields/0/type/0" {code}

Instead, we currently get:
{code:java}
message:  "reader type: int not compatible with writer type: null"
location: "/" {code}
 

 

losing all location information.
 



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