Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Here is a JSON representation of a test case that produces unexpected behaviour under the Java Avro implementation.
The test verifies that the JSON data in inData with encoding inSchema produces outData when read as outSchema.
The specification says: "The first schema in the reader's union that matches the selected writer's union schema" which to me says that the output should be a long, because long is before int in the reader's union and long matches int.
To reproduce on the command line, you'll need a version of avro-tools with this PR applied, then run:
echo '{"F":{"int":999}}' |
avro fromjson --schema '{"name":"R","type":"record","fields":[
]}' - |
avro tojson --reader-schema '{"name":"R","type":"record","fields":[
]}' -
This prints:
{"F":{"int":999}}
but I'd expect to see this:
{"F":{"long":999}}