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_r388735355
 
 

 ##########
 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 this is a parser exception, then we can just ignore exception here 
instead of propagating it, this will also be better for performance. 
   
   ```java
   } catch (NumberFormatException e) {
     if (!ignoreParseErrors) {
        throw e;
     }
   }
   ```
   
   

----------------------------------------------------------------
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