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

 ##########
 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:
   Use a unify style?

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