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_r388754235
 
 

 ##########
 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:
   Yes. We should return null if errors is ignored. We can wrap this logic into 
a method to reduce duplicate code. 

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to