exists [frame(...)]?, [predicate: bool]+

Keeps rows from the primary input where the join predicate matches at least one row from another dataset at some time within the query window.

The output schema matches the left input: no columns are added from the right dataset. Predicate arguments must be boolean expressions; if you pass several, they are combined with logical and. Together they must reference exactly one additional dataset (for example via @other.column). Window functions and aggregate functions are not allowed in these predicates—compute them in an upstream stage and reference the result here.

Without an optional frame argument, the right-hand side is restricted to the query window; if that dataset is temporal, it is treated as non-temporal for the purpose of the join. With frame(back: …, ahead: …) you must use back and ahead, not start or end, and both inputs must have timestamps (Event, Interval, or Resource datasets, not plain tables). In that mode matching uses those offsets around each left row’s time relative to the right-hand row times.

For the inverse test (keep rows with no match), use not_exists. To return rows from the other dataset instead, see follow. For a full relational join that adds columns, see join or leftjoin.

Categories

Accelerable

exists is accelerable if there is a frame() argument. A dataset that only uses accelerable verbs can be accelerated, making queries on the dataset respond faster.

Examples

exists user_id=@audit.user_id

Demonstrates a single join predicate that references one other dataset, keeping only left-hand rows that have a matching partner within the query window without projecting any right-hand columns.

exists frame(back:1h, ahead:1h), host=@deployments.host AND env=@deployments.env

Uses an explicit frame so each left-hand row looks backward and forward in time when testing the predicate, instead of relying only on the global query window.

exists sku=@orders.sku, region=@orders.region

Passes two boolean predicate arguments that the compiler combines before evaluating the semijoin, so every listed condition must hold against the same right-hand dataset.