Hi,

I’m working with Avro Turf which in turn works with Avro. Currently using 
version 1.8.2. I have the following schema:
{
  "type": "record",
  "name": “my_record",
  "fields": [
    {
      "name": "work_sample",
      "type": [
        {
          "type": "map",
          "values": "long"
        },
        "null"
      ],
      "default": null
    }
  ]
}

and I am trying to read the following data with this schema:
{
  "id": 457604,
  "updated_at": 1531640762,
  "is_allowed": true
}

Since I have default null, I expected to get 
{"work_sample":null}

However, what I get is an error. This seems to work as expected for the array 
case. It looks like since in the array case a type check is done before, 
allowing it to receive null values and apply the default. I fixed this locally 
and it looks okay. I have opened a pull request I’d love you guys to have a 
look:
https://github.com/apache/avro/pull/403/files 
<https://github.com/apache/avro/pull/403/files>

Thanks,
Oded Zahavi

Reply via email to