Details
-
Sub-task
-
Status: Closed
-
Blocker
-
Resolution: Duplicate
-
1.5.0
-
None
-
None
Description
Emitting a query result that contains a rowtime attribute fails with the following exception:
Caused by: java.lang.ClassCastException: java.sql.Timestamp cannot be cast to java.lang.Long at org.apache.flink.api.common.typeutils.base.LongSerializer.serialize(LongSerializer.java:27) at org.apache.flink.api.java.typeutils.runtime.RowSerializer.serialize(RowSerializer.java:160) at org.apache.flink.api.java.typeutils.runtime.RowSerializer.serialize(RowSerializer.java:46) at org.apache.flink.api.java.typeutils.runtime.TupleSerializer.serialize(TupleSerializer.java:125) at org.apache.flink.api.java.typeutils.runtime.TupleSerializer.serialize(TupleSerializer.java:30) at org.apache.flink.streaming.experimental.CollectSink.invoke(CollectSink.java:66) ... 44 more
The problem is cause by the ResultStore which configures the CollectionSink with the field types obtained from the TableSchema. The type of the rowtime field is a TimeIndicatorType which is serialized as Long. However, in the query result it is represented as Timestamp. Hence, the type must be replaced by a SqlTimeTypeInfo<Timestamp>.