wuchong commented on a change in pull request #10518: [FLINK-15124][table] Fix
types with precision defined in DDL can't be executed
URL: https://github.com/apache/flink/pull/10518#discussion_r356392994
##########
File path:
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/codegen/SinkCodeGenerator.scala
##########
@@ -223,10 +224,10 @@ object SinkCodeGenerator {
case (fieldTypeInfo, i) =>
val requestedTypeInfo = tt.getTypeAt(i)
validateFieldType(requestedTypeInfo)
- if (!areTypesCompatible(
- fromTypeInfoToLogicalType(fieldTypeInfo),
- fromTypeInfoToLogicalType(requestedTypeInfo)) &&
- !requestedTypeInfo.isInstanceOf[GenericTypeInfo[Object]]) {
+ if (!PlannerTypeUtils.isAssignable(
+ fromTypeInfoToLogicalType(fieldTypeInfo),
+ fromTypeInfoToLogicalType(requestedTypeInfo)) &&
+ !requestedTypeInfo.isInstanceOf[GenericTypeInfo[Object]]) {
Review comment:
1. It's safe to be assignable (ignore precision and nullablitiy).
2. Currently, almost all the sinks are using TypeInformations (e.g.
UpsertTableSink can only use TypeInformations). And TypeInformations will lose
precision informations which will lead to be always type-incompatible.
----------------------------------------------------------------
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