我需要计算KSQL confluent.cloud.中两个时间戳的差异
以下是我的问题,
SELECT
ENTITY -> IENTITYID,
ENTITY -> DTINSERTDATE,
ENTITY -> DTUPDATEDATE,
HEADERS -> OPERATION,
TIMESTAMPTOSTRING(ROWTIME, 'yyyy-MM-dd HH:mm:ss.SSS') AS rowtime_formatted,
CAST(ENTITY -> DTUPDATEDATE AS TIMESTAMP) AS UpdatedDateFROMtblEntity
FROM tblEntity
EMIT CHANGES
LIMIT 10;
在这里,我有两个时间戳,比如ROWTIME和UpdatedDateFROMtblEntity。那么,如何计算这些时间戳上的差异呢?。我需要在几毫秒内完成。请帮我解决这个问题。
SELECT UNIX_TIMESTAMP(col1) - UNIX_TIMESTAMP(col2)
FROM STREAM1 EMIT CHANGES;
参考:https://docs.ksqldb.io/en/latest/developer-guide/ksqldb-reference/scalar-functions/#unix_timestamp