set_timestamp

Type of operation: Metadata

Description

Declare the timestamp of the output to be the named column, which must have the timestamp type. The input of the verb must be in an event shape. See set_valid_from and set_valid_to about how to change the time columns of a resource or interval input.

Beware changing time to a field that is too far off from the current timestamp field, because it may end up falling outside of the processing time window. Rows where the difference between the old and new timestamps in either direction exceeds a configurable parameter max_time_diff are excluded from the output.

Alternatively, a frame can be used instead of the max_time_diff option to specify different values for the allowed time range in either direction. Any row with a new timestamp value that lies outside this frame around its original timestamp is not included in the output.

Specifying both frame and max_time_diff option is not allowed. If neither is specified, a default value of 1 hour is assumed for max_time_diff.

If you use set_timestamp and see no data, chances are that the timestamps in the new column are too far away from the previous time column value, and you need a bigger max_time_diff option.

Usage

set_timestamp [ options ], [ frame ], columnname

Argument

Type

Optional

Repeatable

Restrictions

options

options

yes

no

constant

frame

frame

yes

no

constant

columnname

timestamp

no

no

column

Options

Option

Type

Meaning

max_time_diff

duration

The new timestamp will be no further away from the old timestamp than this (default 1h)

Accelerable

set_timestamp is always accelerable if the input is accelerable. A dataset that only uses accelerable verbs can be accelerated, making queries on the dataset respond faster.

Examples

set_timestamp ts_col

Sets the timestamp column of the output dataset as the ts_col field.

set_timestamp options(max_time_diff: 1h), ts_col

Sets the timestamp column of the output dataset as the ts_col field, and the maximum time difference between the original timestamp field and ts_col is less than one hour.

set_timestamp frame(back: 2h, ahead:20m), ts_col

Sets the timestamp column of the output dataset as the ts_col field, and filters the output to only contain rows where ts_col is at most 2 hours behind or 20 minutes ahead of the original timestamp field.