Three Stream Joins — Stream–Stream, Stream–Table, Table–Table
Chapter 12 — every stream join keeps state; the window decides how much state and when it is released
Stream–Stream Join · Window
search events
«stream»
key: session id
click events
«stream»
key: session id
WindowJoinOperator
«windowed join on session id»
state: buffer of last 1 h, by session id
buffer entries evicted when window closes
join output
clicked — the search got a click
not clicked — window expired alone
annotation
click may arrive before the search event;
the window bounds how long the join waits
state is dropped once the window closes
Stream–Table Join · Enrichment
activity events
«stream»
key: user id
profile changelog
«CDC stream»
key: user id
StreamTableJoin
«stream ⋈ table · infinite window»
state: local copy of profiles (hash join)
newer versions overwrite older ones
enriched activity events
activity events enriched with profile
as of the latest profile version seen
annotation
table side = join with an infinite window;
the operator keeps the latest profile per key
output depends on the arrival order of sides
Table–Table Join · Materialized View
posts changelog
«CDC stream»
key: post id
follows changelog
«CDC stream»
key: user id
ViewMaintenanceOperator
«equi-join · posts ⋈ follows»
state: follower lists + recent posts
both sides are changelogs of tables
timeline changes
delta output: rows entering / leaving view
materialized view of posts ⋈ follows
annotation
(u · v)′ = u′v + uv′ — the product rule:
each change joins the other side's latest
state; the view is maintained incrementally