Built-in function examples
Examples that convert epoch seconds and epoch milliseconds to timestamps.
Cloudera SQL Stream Builder (SSB) adds the EPOCH_TO_TIMESTAMP and EPOCHMILLIS_TO_TIMESTAMP
functions to the Flink built-in functions. For more information, see System
functions.
Convert epoch seconds to a timestamp
SELECT EPOCH_TO_TIMESTAMP(1593718981)
FROM ev_sample_fraud;
Convert epoch milliseconds to a timestamp
SELECT EPOCHMILLIS_TO_TIMESTAMP(1593718838150)
FROM ev_sample_fraud;
The Flink built-in function TO_TIMESTAMP_LTZ does the same, and returns a
TIMESTAMP_LTZ value. The second argument is the precision: 0 for seconds, 3
for milliseconds.
SELECT TO_TIMESTAMP_LTZ(1593718838150, 3)
FROM ev_sample_fraud;
For the Flink functions, see Built-in functions in the Apache Flink documentation.
