[ 
https://issues.apache.org/jira/browse/AVRO-3979?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chanzo Bryan updated AVRO-3979:
-------------------------------
    Description: 
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.
 

  was:
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.
 


> 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.12.0, 1.11.3, 1.11.4
>            Reporter: Chanzo Bryan
>            Priority: Major
>   Original Estimate: 20m
>  Remaining Estimate: 20m
>
> 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)

Reply via email to