Function Name | Description | Sample |
cast(date_string as timestamp) | Converts a long or text timestamp into TIMESTAMP , which can be used in time grouping function histogram and time display | cast(1597807109000 as timestamp) Result: 2020-08-19T03:18:29.000Z |
__TIMESTAMP__
to TIMESTAMP
.* | select cast(TIMESTAMP as timestamp)
time:1597807109
) of logs to TIMESTAMP
.* | select cast(time*1000 as timestamp)
histogram(__TIMESTAMP__, interval)
\\_\\_TIMESTAMP\\_\\_
can be the value of long
in milliseconds or a value in TIMESTAMP format. You can convert a time string in the ISO 8601 or UNIX time format to the TIMESTAMP format.interval
supports the following time units: SECOND, MINUTE, HOUR, DAY, MONTH, and YEAR. For example, INTERVAL 5 MINUTE
indicates an interval of 5 minutes.long
is a timestamp in milliseconds, equivalent to the \\_\\_TIMESTAMP\\_\\_
.histogram(long, interval)
* | select histogram(cast(__TIMESTAMP__ as timestamp),INTERVAL 5 MINUTE) AS dt, count(*) as PV group by dt order by dt limit 1000
Was this page helpful?