allegro / json-avro-converter

JSON to Avro conversion tool designed to make migration to Avro easier.
Other
277 stars 97 forks source link

Added support for non-finite float and double values #57

Open fmiguelez opened 3 years ago

fmiguelez commented 3 years ago

When a Java float or double value contains a non-finite value (Infinity, -Infinity, NaN) it is serialized in JSON as a String instead of a number (e.g. 3.1416), as JSON numbers do not support non-finite values.

If we try to convert a JSON with such values to AVRO it will fail.

We have added support in JsonGenericRecordReader to support parsing float and double numbers as strings so "NaN", "Infinite" and "-Infinite" are now parseable.