Hi all,

 

I am working with two schemas and I have a question about compatibility in regards to nullable unions.

 

Let’s say I have a record with a single union field. In Schema A, the first union may be null or a string. In schema B, the  union may be null or an int. The record names are the same between the twos chemas. According to avro spec section on Schema Resolution:

 

if both are unions: The first schema in the reader's union that matches the selected writer's union schema is recursively resolved against it. if none match, an error is signalled.

 

Does this mean that Schema A and Schema B are compatible because both unions can be null even though the other type is not compatible between the two schemas? I would have expected that compatibility would only be true if both types in a union matched between the two schemas.

 

Thanks,

Joe

 

 

See schemas below.

 

Schema A:

 

{

  "type": "record",

  "namespace": "com.acme ",

  "name": "Outer",

  "fields": [

    {

      "name": "inner",

      "type": [

        "null",

        “string”

       ]

}

 

 

Schema B:

 

{

  "type": "record",

  "namespace": "com.acme ",

  "name": "Outer",

  "fields": [

    {

      "name": "inner",

      "type": [

        "null",

        “int”

       ]

}

 

Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email. Please advise immediately if you or your employer does not consent to Internet email for messages of this kind. Opinions, conclusions and other information in this message that do not relate to the official business of my firm shall be understood as neither given nor endorsed by it.

Reply via email to