[
https://issues.apache.org/jira/browse/FLINK-19200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17196729#comment-17196729
]
Jark Wu commented on FLINK-19200:
---------------------------------
IMO, returning seconds or milliseconds depends on the format of time string is
confusing.
I think there are several solutions, e.g.
1) supports {{MILLISECOND(timestamp)}} function [1] which returns the int
millisecond portion of a timestamp/string value.
2) UNIX_TIMESTAMP returns DECIMAL if the argument is given that includes a
fractional seconds part.
e.g. {{UNIX_TIMESTAMP('2020-09-11 13:14:29.153', 'yyyy-MM-dd HH:mm:ss.SSS') =
1599801269.153}}. This also follows MySQL's way [2].
[1]:
https://impala.apache.org/docs/build/html/topics/impala_datetime_functions.html#datetime_functions__millisecond
[2]:
https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_unix-timestamp
> UNIX_TIMESTAMP function support return in millisecond
> -----------------------------------------------------
>
> Key: FLINK-19200
> URL: https://issues.apache.org/jira/browse/FLINK-19200
> Project: Flink
> Issue Type: Improvement
> Components: Table SQL / Planner
> Affects Versions: 1.10.0
> Reporter: leslieyuan
> Priority: Major
>
> Now i use Flink1.10.0, i found that:
> time = "2020-09-11 13:14:29.153"
> UNIX_TIMESTAMP(time) return 1599801269
> UNIX_TIMESTAMP(time, 'yyyy-MM-dd HH:mm:ss.SSS') also return 1599801269
> Yes, i see the Official website description, this function return in seconds,
> but i think if i had given the format as above, which means that i need the
> millisecond.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)