surrounding

Type of operation: Join

Description

Rows from the “right” dataset that fall within the specified frame of at least one row in the default dataset are unioned with the input dataset. The shape of output would be as if the right dataset and left dataset were combined using the union verb.

The column bindings are applied only to the rows of the input dataset. Rows from the right dataset will have these new columns set to null in the output.

Usage

surrounding frame, source [ , column bindings ] ...

Argument

Type

Required

Multiple

frame

frame

Required

Only one

source

datasetref

Required

Only one

column bindings

expression

Optional

Can be multiple

Accelerable

surrounding 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

filter 
surrounding frame(back: 2s, ahead: 2s), @logs, panic:true

After filtering to the rows matching “panic”, this pulls in all the rows from “logs” whose timestamp is within 2s of the filtered rows. In the output, rows from the input dataset will have “panic” field populated with true. Rows from the “logs” dataset will have this field set to null.