wuchong commented on a change in pull request #10403: [FLINK-14645][table] 
Support to keep nullability and precision when converting DataTypes to 
properties
URL: https://github.com/apache/flink/pull/10403#discussion_r354393065
 
 

 ##########
 File path: 
flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/JsonRowDeserializationSchema.java
 ##########
 @@ -340,56 +340,68 @@ private DeserializationRuntimeConverter 
createFallbackConverter(Class<?> valueTy
                        return Optional.of(createTimeConverter());
                } else if (simpleTypeInfo == Types.SQL_TIMESTAMP) {
                        return Optional.of(createTimestampConverter());
+               } else if (simpleTypeInfo == Types.LOCAL_DATE) {
+                       return Optional.of(this::convertToLocalDate);
+               } else if (simpleTypeInfo == Types.LOCAL_TIME) {
+                       return Optional.of(this::convertToLocalTime);
+               } else if (simpleTypeInfo == Types.LOCAL_DATE_TIME) {
+                       return Optional.of(this::convertToLocalDateTime);
                } else {
                        return Optional.empty();
                }
        }
 
+       private LocalDate convertToLocalDate(ObjectMapper mapper, JsonNode 
jsonNode) {
+               return 
ISO_LOCAL_DATE.parse(jsonNode.asText()).query(TemporalQueries.localDate());
+       }
+
        private DeserializationRuntimeConverter createDateConverter() {
 
 Review comment:
   I think this has already been updated. I don't want to change other types 
converter, because they are clearer now. 

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

Reply via email to