w_ts as TO_TIMESTAMP(FROM_UNIXTIME(rowtime/1000),'yyyy-MM-dd 
HH:mm:ss'),这个语句产生的就是一个timestamp的数据Flink内置函数:https://ci.apache.org/projects/flink/flink-docs-release-1.10/zh/dev/table/functions/systemFunctions.htmlFROM_UNIXTIME(numeric[,
 string]):
Returns a representation of the numeric argument as a value in string format 
(default is 'YYYY-MM-DD hh:mm:ss'). numeric is an internal timestamp value 
representing seconds since '1970-01-01 00:00:00' UTC, such as produced by the 
UNIX_TIMESTAMP() function. The return value is expressed in the session time 
zone (specified in TableConfig).
E.g., FROM_UNIXTIME(44) returns '1970-01-01 09:00:44' if in UTC time zone, but 
returns '1970-01-01 09:00:44' if in 'Asia/Tokyo' time zone.
Only supported in blink planner.
TO_TIMESTAMP(string1[, string2]):
Converts date time string string1 with format string2 (by default: 'yyyy-MM-dd 
HH:mm:ss') under the session time zone (specified by TableConfig) to a 
timestamp.
Only supported in blink planner.



[email protected]
 
发件人: [email protected]
发送时间: 2020-05-28 16:22
收件人: user-zh
主题: flink-sql watermark问题
flink-1.10 sql只支持 timestamp(3) 类型字段生成watermark
但是long这样转换后也可以生成watermark很奇怪?
CREATE TABLE user_log (
response_size int,
rowtime BIGINT,
w_ts as TO_TIMESTAMP(FROM_UNIXTIME(rowtime/1000),'yyyy-MM-dd HH:mm:ss'),
WATERMARK FOR w_ts AS w_ts - INTERVAL '5' SECOND --5秒的延迟
)
 
 
 
[email protected]

回复