Re: What are the rules when encoding a union of records and/or maps?

2021-03-11 Thread Spencer Nelson
It turns out that the Python implementation takes the last path that matches. Agreed that it's deterministic within a language, but it might round-trip inconsistently. For example, suppose Java takes the first path that matches, and Python takes the last path that matches. Then, if I 1.

Re: What are the rules when encoding a union of records and/or maps?

2021-03-05 Thread Ryan Blue
I think the behavior when encoding that would be to produce the map. I would expect that because I'm assuming Python uses the first path that appears to match. When it's ambiguous which way an in-memory representation maps to a schema, it's up to the implementation to choose. Whatever python

What are the rules when encoding a union of records and/or maps?

2021-03-04 Thread Spencer Nelson
Suppose a schema like this - a union of a map and a record: [ {"type": "map", "values": "int"}, {"type": "record", "name": "Record", fields: [{"name": "field", "type": "int"}]} ] In Python, unserialized maps and records are both represented as dictionaries. So, if an Avro Python library