Wired behavior of DATE_FORMAT UDF in Flink SQL

Posted by 徐涛 on
URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/Wired-behavior-of-DATE-FORMAT-UDF-in-Flink-SQL-tp24193.html

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, 
select 
 ALBUM_ID, 
 UNLOCK_USER_ID, 
 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? 

Best
Henry