set_valid_to

Type of operation: Metadata

Description

Declare the valid to of the output to be the named column, which must be a timestamp column. Omitting the column name will clear the valid to, changing an interval input to a point-time output. This is a low-level function that will generate confusing results if not used as part of a larger context. It is recommended to instead use make_resource or update_resource or timechart to go from event to resource, and make_event to go from resource to event shape. If you absolutely need this: Beware changing time to a value 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 valid to 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 that lies ahead of its original timestamp beyond frame.ahead is not included in the output.

Also, setting a valid to that is before the valid from time will cause the row to be filtered out.

The valid to value must be a column that already exists, not an expression, and must be a timestamp type, so you may need to re-shape columns with make_col before you use this verb.

Usage

set_valid_to [ options ], [ frame ], [ columnname ]

Argument

Type

Optional

Repeatable

Restrictions

options

options

yes

no

constant

frame

frame

yes

no

constant

columnname

timestamp

yes

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_valid_to 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_valid_to ts_col

Sets the valid to designation of the output dataset as the ts_col field.

set_valid_to options(max_time_diff: 1h), ts_col

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

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

Sets the valid to designation 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 valid to field.

Aliases

  • setvt (deprecated)