You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Roger (Jira)" <ji...@apache.org> on 2020/01/20 12:06:00 UTC

[jira] [Created] (AVRO-2706) union reading does not use first matching member

Roger created AVRO-2706:
---------------------------

             Summary: union reading does not use first matching member
                 Key: AVRO-2706
                 URL: https://issues.apache.org/jira/browse/AVRO-2706
             Project: Apache Avro
          Issue Type: Improvement
          Components: java
            Reporter: Roger


[Here|https://gist.github.com/rogpeppe/5faf971eec51f3dbd316bb71d6d5dccc] is a JSON representation of a test case that fails with the Java implementation of Avro.

To reproduce on the command line with avro-tools, you'll need a version of avro-tools with https://github.com/apache/avro/pull/785 committed. I've used the name "avro" as a synonym for running the avro-tools jar under the Java VM:

 	echo '{"F":{"int":999}}' |
	avro fromjson --schema '{"name":"R","type":"record","fields":[{"name":"F","type":["int","string"],"default":1234}]}' - |
	avro tojson --reader-schema '{"name":"R","type":"record","fields":[{"name":"F","type":["long","int","string"],"default":1234}]}'  -

This produces:

    {"F":{"int":999}}

whereas I'd expect to see "long", because the first matching item in the union is "long".




--
This message was sent by Atlassian Jira
(v8.3.4#803005)