Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-3979

Python SchemaCompatibility doesn't set location properly for type mismatch with writer unions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.12.0, 1.11.3, 1.11.4
    • None
    • python
    • None
    • Python: Fixes schema incompatibility location for a type mismatch with a writer union schema.

    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:

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

       

      and a writer record schema with an optional int (union of int and null) field a:

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

       

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

      message:  "reader type: int not compatible with writer type: null"
      location: "/fields/0/type/0" 

       

      Instead, we currently get:

      message:  "reader type: int not compatible with writer type: null"
      location: "/" 

       

      losing all location information.
       

      Attachments

        Activity

          People

            Unassigned Unassigned
            chainso Chanzo Bryan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 20m
                20m
                Remaining:
                Remaining Estimate - 20m
                20m
                Logged:
                Time Spent - Not Specified
                Not Specified