avro icon indicating copy to clipboard operation
avro copied to clipboard

AVRO-2032: [C#] Add support for NaN, Infinity and -Infinity in JsonDecoder

Open zcsizmadia opened this issue 1 year ago • 1 comments

What is the purpose of the change

JsonEncoder uses special string values to represent NaN, Infinity and -Infinity values for float and double values, but JsonDecoder does not accept these string values. This change adds support for these special values to JsonDecoder.

Verifying this change

This change added tests and can be verified as follows:

  • The change adds an unit tests which verifies all 6 special cases:
    • NaN for float fields
    • NaN for double fields
    • Infinity for float fields
    • Infinity for double fields
    • -Infinity for float fields
    • -Infinity for double fields
  • These values are defined in Jackson.
    StdDeserializer

Documentation

  • This PR doesn't introduce a new feature but implements a behavior which is not documented at all.
  • The Avro spec doesn't mention how these special cases are handled in JSON (RFC 8259 does not define numeric literals for NaN, Infinity and -Infinity)
  • JsonEncoder/JsonDecoder resemble the behavior of Jackson

zcsizmadia avatar Aug 07 '24 03:08 zcsizmadia

Same as #3066

zcsizmadia avatar Aug 07 '24 03:08 zcsizmadia