Create time buckets for the given table.
Create time buckets for the input table. Each event is assigned to a time bucket based on its start and end time. The start time of the bucket is saved in
lhub_start_ts and the end time of the bucket is saved in
lhub_end_ts for each event.
select *, timeBucket(column, bucketDef) as timebucket from table
column: The column to run timeBucket on. This column needs to have integers in it.
bucketDef: String that defines a time bucket. The string has the following format: (integer)('s' or 'm' or 'h' or 'd') where 's' stands for seconds, 'm' stands for minutes, 'h' stands for hours, and 'd' stands for days. Some examples of valid strings are the following: "3s" = 3 seconds "5m" = 5 minutes
The column named in the UDF invocation will have the start time of the time buckets for each row.
select *, timeBucket(lhub_ts, "1m") as timebucket from table
|11/30/2017 23:35:29||11/30/2017 23:35:00|
|11/30/2017 23:35:44||11/30/2017 23:35:00|
|11/30/2017 23:35:54||11/30/2017 23:35:00|
Updated about 2 years ago