raminqaf commented on code in PR #28758:
URL: https://github.com/apache/flink/pull/28758#discussion_r3610225458
##########
flink-core/src/test/java/org/apache/flink/types/variant/BinaryVariantInternalBuilderTest.java:
##########
@@ -120,6 +122,15 @@ void testParseJsonObject() throws IOException {
assertThat(variant.getField("k2").getDecimal()).isEqualTo(BigDecimal.valueOf(1.5));
}
+ @ParameterizedTest
+ @ValueSource(strings = {"NaN", "Infinity", "-Infinity"})
+ void testParseJsonRejectsNonNumericNumbers(final String nonNumericNumber) {
+ // NaN and the infinities are not valid JSON, so parsing fails:
PARSE_JSON surfaces the
+ // error and TRY_PARSE_JSON returns NULL.
Review Comment:
`NaN` and `Infinity` are not part of the JSON specification:
https://www.rfc-editor.org/info/rfc8259/#section-6
>Numeric values that cannot be represented in the grammar below (such as
Infinity and NaN) are not permitted.
Jackson does not allow it by default and you need to switch a flag to allow
it. To represent them, the user has to define them as string and cast them as
float. The workaround is documented in the variant type
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]