Hi Ryan,

I think the Python impl does the right thing.

You say that Java currently works fine with "record".
Does it work because you tried with Java 14- (i.e. no support for record
types - https://docs.oracle.com/en/java/javase/14/language/records.html) or
because the special name "record" is mangled to "record$" ?

In any case your example in the ticket

{"type":"record","name":"LinkedList","fields":[
  {"name":"value","type":"int},
  {"name":"next","type":["null",{"type":"LinkedList"}]}]}"

convinced me that "record", "enum" and "fixed" should be treated as the
primitive types.

Martin

On Fri, Feb 4, 2022 at 1:13 PM Ryan Skraba <r...@skraba.com> wrote:

> Hello!  I created the JIRA AVRO-3370[1] that demonstrates two
> different behaviours between Java and python with respect to using
> complex types (such as "record" as a name in a named type).
>
> This is specifically an issue because Flink is generating these types
> of records (in the Java world), and they are subsequently not
> interoperable with Python users.[2]
>
> There's probably two fixes to be done here:
>
> - Better define the behaviour so all language SDKs are consistent, and
> - Contribute an upstream fix to Flink so that it's compatible with python.
>
> What do you think is the right thing to do?  Should we be able to
> define a record named record (the Java behaviour) or should the spec
> be stricter about using types like names (the Python behaviour)?
>
> All my best, Ryan
>
> [1]: https://issues.apache.org/jira/browse/AVRO-3370
> [2]:
> https://github.com/apache/flink/blob/release-1.14.3/flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/typeutils/AvroSchemaConverter.java#L307
>

Reply via email to