on¶
Description¶
on is a special function used to specify the join condition for some join
verbs. (for example, join and lookup).
The function allows you to specify a join predicate (any boolean expression) and an optional time frame using the frame or frame_exact function.
Return type¶
joinpredicate
Domain¶
This is a scalar function (calculates a single output value for a single input row.)
Categories¶
Usage¶
on(expr, [ frame ])
Argument |
Type |
Optional |
Repeatable |
Restrictions |
|---|---|---|---|---|
expr |
bool |
no |
no |
none |
frame |
frame |
yes |
no |
constant |
Examples¶
join on([email protected]), name:@container.name
Perform an inner-join between the default input of the verb and input
@container based on the condition that the default input’s column
container_id must equal to the other input’s id column. Because the =
operator (eq) is used to compare the two columns, a null container_id
cannot be joined against a null id or any other value.
join on(same(container_id, @container.id)), name:@container.name
Perform an inner-join between the default input of the verb and input
@container based on the condition that the default input’s column
container_id must contain the same value as the other input’s id column.
Because same is used to compare the two columns, a null
container_id can also join with a null id from the other input.
join on(value > @right.min and value < @right.max), name:@right.name
Perform an inner-join between the default input of the verb and input @right
based on the condition value must be within the range defined by min and
max.
join on([email protected], frame(back:5s, ahead:1s)), name:@right.name
Perform an inner join between the default input and input @container. The
container_id from the default input must equal to the id column from the
input @container, and the timestamp from the input @container must overlap
with a window of [t - 5s, t + 1s] where t is the timestamp of the default
input.