KalleOlaviNiemitalo commented on PR #3051: URL: https://github.com/apache/avro/pull/3051#issuecomment-2254331725
The code you linked to is in the Java implementation of Avro IDL. The Java code that parses Avro schemas from JSON does not allow `"default": "NaN"` for a floating-point field: <https://github.com/apache/avro/blob/42c54e68120bb5c2393954b5990a0aa3b3960510/lang/java/avro/src/main/java/org/apache/avro/Schema.java> For Avro IDL, the Java implementation seems to expect `float val = NaN;` without quotation marks, rather than `float val = "NaN";`. Also, it allows hexadecimal floating-point literals, hexadecimal integer literals, and octal integer literals, even though those are not valid in JSON. So, this part of the Avro IDL specification at <https://avro.apache.org/docs/1.11.1/idl-language/#default-values> > Default values for fields may be optionally specified by using an equals sign after the field name followed by a JSON expression indicating the default value. This JSON is interpreted as described in the [spec](https://avro.apache.org/docs/1.11.1/specification/#schema-record). fails to describe the de-facto support for those non-JSON syntaxes. Now if you change the Avro specification to allow `"NaN"`, `"Infinity"`, and `"-Infinity"` as default values in JSON, I think the Avro IDL specification must also be changed to state that those quoted forms are not valid in Avro IDL and that the unquoted literals must be used instead. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@avro.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org