Details
Description
A change made in NodeImpl.cc under AVRO-1026 has introduced a bug that corrupts JSON schemas when writing them to disk or dumping to a stream. This manifested when using DataFileWriter to generate a data file, and the schema stored in the header was corrupted from the original schema provided.
e.g
This:
{ “type”: “fixed”, “name”: “Unsigned16”, “size”: 2 }
Becomes this:
{ “type”: “fixed”, “size”: 2, “name” : “Unsigned16”, }
Note the extraneous comma after the ‘name’ attribute.
The bug exists for Avro 'fixed' types, and has not been observed for other types. A test case will be developed.
The bug can be fixed by simply re-ordering the code in NodeFixed::printJson.