Skip to main content
Version: Next

Stream joins

A stream-stream join correlates two event streams by key inside a bounded time interval. ArkFlow implements it as a keyed interval join operator in the Job DAG: two inputs, one key per side, and an event-time distance bound.

The join is not a lookup join. Both sides are streams; state is kept per key only for as long as the interval and TTL require, and matches emit as soon as the second side arrives.

Shape of the operator​

A join operator declares exactly two inbound edges and names its sides by upstream operator id (left_from / right_from), not by channel order. The configuration carries:

FieldMeaning
left_from, right_fromUpstream operator ids of the two sides.
left_key, right_keyEquality keys on each side.
window_msMaximum allowed difference between the two event timestamps.
left_timestamp, right_timestampTimestamp columns; default __meta_timestamp.
ttl_msHow long a row stays joinable after its interval expires.
max_per_keyPer-side row cap for one key (bounds skew).
join_typeinner (default), left_outer, right_outer, full_outer.

Semantics​

  • Match rule. Keys are equal and the event timestamps differ by at most window_ms. Matches emit immediately, regardless of join_type.
  • Event-time bounds. A row is evicted once the chain watermark passes timestamp + window_ms + ttl_ms. The chain watermark is the minimum across both sides, so one side cannot advance past the other's unprocessed history.
  • Output shape. Left columns are prefixed l_, right columns r_, plus a join_key column. With an outer join type the side that can be null for unmatched rows becomes nullable in the schema.
  • Outer rows. With left_outer, right_outer, or full_outer, a never-matched row is emitted once the watermark passes timestamp + window_ms + ttl_ms, with the opposite side all null. A row that matched at least once never re-emits as unmatched. The opposite side's schema is required: until that side produces a batch, evicted rows park in a bounded queue (max_per_key, oldest dropped) and flush when the schema arrives. Processing-time sources without watermarks never emit unmatched rows.
  • Bounded state. Each key holds at most max_per_key rows per side; the oldest are evicted first. Under an outer join, capacity eviction also emits the evicted row as unmatched — without a watermark guarantee, so a later match can double-emit. Capacity evictions log a throttled warn with side, key, buffer depth, and the suppressed count.

Replay and recovery​

Join buffers are not a separate snapshot. Recovery rebuilds them, including per-row matched flags, from checkpoint replay; source positions are restored before any input is read, so replay cannot produce a false unmatched row beyond the documented late-data contract. Matches are at-least-once: downstream must tolerate duplicates after recovery.

Constraints​

  • Each side's schema must stay stable for the stream's lifetime.
  • Each side's upstream operator must feed the join from a single subtask; a multi-subtask side fails at graph build time with guidance to set the upstream parallelism to 1.
  • The join and both upstream edges stay co-located on one node. Cross-node shuffle joins are not supported.
  • Temporal (lookup) joins, non-equi joins, and arbitrary interval conditions are not supported. Use the lookup processor for enrichment from a database or the SQL JOIN for batch-local joins.

Configure it​

The operator configuration and a complete runnable YAML are in Stream-stream join. For the watermark mechanics that decide when outer rows emit, read Event time and watermarks.