wuchong commented on a change in pull request #11119: [FLINK-15396][json]
Support to ignore parse errors for JSON format
URL: https://github.com/apache/flink/pull/11119#discussion_r388792571
##########
File path:
flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/JsonRowDeserializationSchema.java
##########
@@ -351,76 +377,131 @@ private DeserializationRuntimeConverter
createFallbackConverter(Class<?> valueTy
}
}
+ private float convertToFloat(ObjectMapper mapper, JsonNode jsonNode) {
+ try {
+ return Float.parseFloat(jsonNode.asText().trim());
+ } catch (NumberFormatException e) {
+ throw createParseErrorException("Unable to deserialize
float.", e);
Review comment:
If the whole json string is invalid, we can simply drop this record, instead
emit a null Row. But for fields, we should use `null` if is invalid.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services