[GitHub] [flink] JingsongLi commented on a change in pull request #10418: [FLINK-15050][table-planner-blink] DataFormatConverters should suppor…

2019-12-04 Thread GitBox
JingsongLi 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_r353641292
 
 

 ##
 File path: 
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/DataFormatConverters.java
 ##
 @@ -169,6 +169,13 @@ public static DataFormatConverter 
getConverterForDataType(DataType originDataTyp
} else {
return new DecimalConverter(ps.f0, 
ps.f1);
}
+   case TIMESTAMP_WITHOUT_TIME_ZONE:
+   int precision = 
getDateTimePrecision(logicalType);
+   if (clazz == Timestamp.class) {
+   return new 
TimestampConverter(precision);
+   } else {
+   return new 
LocalDateTimeConverter(precision);
 
 Review comment:
   You should add `SqlTimestamp` too.


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


[GitHub] [flink] JingsongLi commented on a change in pull request #10418: [FLINK-15050][table-planner-blink] DataFormatConverters should suppor…

2019-12-04 Thread GitBox
JingsongLi 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_r353640867
 
 

 ##
 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:
   Let's remove `SqlTimeTypeInfo` and `LocalTimeTypeInfo`, precision 3 is a 
temporary solution, and should not reach here.


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