LeonYoah commented on code in PR #7157:
URL: https://github.com/apache/seatunnel/pull/7157#discussion_r1675356028


##########
seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/JsonToRowConverters.java:
##########
@@ -250,6 +250,9 @@ private float convertToFloat(JsonNode jsonNode) {
     }
 
     private LocalDate convertToLocalDate(JsonNode jsonNode, String fieldName) {
+        if ("".equals(jsonNode.asText())) {
+            return null;
+        }

Review Comment:
   > I think we can add an option to control this behavior. If a field cannot 
be parsed, return `null` or throw an error. Just like hive. Not just datetime 
type, this rule is suitable for any type of parsing. cc @hailin0
   
   Good idea. You can control whether to throw an exception or return null with 
parameters



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

Reply via email to