Github user dianfu commented on a diff in the pull request:
https://github.com/apache/flink/pull/5025#discussion_r151625442
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/StreamTableEnvironment.scala
---
@@ -234,11 +234,12 @@ abstract class StreamTableEnvironment(
"UpsertStreamTableSink requires that Table has a full primary
keys if it is updated.")
}
val outputType = sink.getOutputType
+ val resultType = getResultType(table.getRelNode, optimizedPlan)
--- End diff --
The `resultType` generated from the optimized plan contains time indicator
information. In `StreamTableEnvironment.translate`, it needs this information
to transform the time indicator column to `TimeStamp` type. For the type
consistent issue, it will be validated during converting CRow to output type:
https://github.com/apache/flink/blob/81dc260dc653085b9dbf098e8fd70a72d2d0828e/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/TableEnvironment.scala#L941
---