[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Wired behavior of DATE_FORMAT UDF in Flink SQL

Hi Experts,
I found that DATE_FORMAT(timestamp,format) returns a TIMESTAMP type, it is wired, because normally format result should be a string type.
In document it says “Formats timestamp as a string using a specified format string”. But when I run it in Flink SQL, 
 DATE_FORMAT(CREATE_TIME, '%Y-%m-%d') as unlock_date 
 from share_album_unlock;

The error throws out:
org.apache.flink.table.api.ValidationException: Field types of query result and registered TableSink mysqlSink do not match.
Query result schema: [ALBUM_ID: Long, unlock_date: Timestamp, score: Long]
TableSink schema:    [ALBUM_ID: Long, time_window: String, score: Long]

The flink version is 1.6.2.
Is it a program bug or something else?