docete commented on a change in pull request #10418: 
[FLINK-15050][table-planner-blink] DataFormatConverters should suppor…
URL: https://github.com/apache/flink/pull/10418#discussion_r353677719
 
 

 ##########
 File path: 
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/DataFormatConverters.java
 ##########
 @@ -281,6 +288,28 @@ public static DataFormatConverter 
getConverterForDataType(DataType originDataTyp
                return ps;
        }
 
+       private static int getDateTimePrecision(LogicalType logicalType) {
+               if (logicalType instanceof TimestampType) {
+                       TimestampType dt = (TimestampType) logicalType;
+                       return dt.getPrecision();
+               } else {
+                       TypeInformation typeInfo = ((LegacyTypeInformationType) 
logicalType).getTypeInformation();
+                       if (typeInfo instanceof LegacyTimestampTypeInfo) {
+                               LegacyTimestampTypeInfo dt = 
(LegacyTimestampTypeInfo) typeInfo;
+                               return dt.getPrecision();
+                       } else if (typeInfo instanceof 
LegacyLocalDateTimeTypeInfo) {
+                               LegacyLocalDateTimeTypeInfo dt = 
(LegacyLocalDateTimeTypeInfo) typeInfo;
+                               return dt.getPrecision();
+                       } else if (typeInfo instanceof SqlTimeTypeInfo) {
+                               return 3;
 
 Review comment:
   OK, we follow the definition in TimestampType, using 6 as the default 
precision.

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