[GSoC 2026] Kafka Streams runner — GroupByKey (GlobalWindow, fire at watermark)
Tracking issue: #18479 Follows: #39051 (KStreamsPayload serde, merged)
Summary
First GroupByKey — the simplest version agreed with @je-ik: GlobalWindow + default trigger, no allowed lateness. This is the runner's first stateful, shuffle-bearing transform and the gateway to the first @ValidatesRunner test.
Design (agreed with @je-ik)
- Repartition is done by Kafka Streams: extract the Beam GBK key, set it as the Kafka record key, and shuffle through an internal repartition topic — so it is multi-instance. Uses the KStreamsPayload serde from #39051.
- Values are buffered in a Kafka Streams state store (so they survive to fire).
- Each key fires once when the watermark reaches TIMESTAMP_MAX (GlobalWindow's
end), emitting KV<K, Iterable
>.
Scope (this PR)
- Register beam:transform:group_by_key:v1 as a runner-native primitive (knownUrns + IsKafkaStreamsNativeTransform, same as Redistribute).
- GroupByKeyTranslator: re-key by the encoded Beam key; repartition through an internal topic (addSink keyed by the Beam key + addSource back) using KStreamsPayloadSerde; add a per-key state store.
- GroupByKeyProcessor: buffer WindowedValue<KV<K,V>> per key in the state store;
on the terminal watermark, emit KV<K, Iterable
> per key; fan the watermark out to all repartition partitions so every task fires. - GlobalWindow + default trigger, no allowed lateness.
Out of scope (later slices)
- Fixed/sliding/session windows, custom triggers, allowed lateness — these will reuse runner-core GroupAlsoByWindow (SystemReduceFn) like Flink/Spark do, and need the state + timers work.
- Combine (this is GroupByKey only).
Testing
- TopologyTestDriver E2E: Impulse -> produce KVs -> GroupByKey -> assert grouped output.
- First @ValidatesRunner test on the GroupByKey category (global window) with PAssert. (If wiring @ValidatesRunner into the gradle config turns out large, it may split into a follow-up; the GBK itself lands here.)
Hi @junaiddshaukat i want to work on this issue but i have few questions : To fan out the watermark correctly, does WatermarkManager already support broadcasting the watermark to all tasks/partitions, or should we modify GroupByKeyProcessor to explicitly handle watermark propagation to downstream nodes? Should the internal repartition topic be created dynamically via the runner, or is it assumed to be managed/auto-created by Kafka Streams?
could you please answer these
please check the below pr
.take-issue
could you please help me with the above quesitions and review the pr
could you please help me with the above quesitions and review the pr
Hi @boy397 — thanks for the interest! This is a GSoC 2026 sub-issue for the Kafka Streams runner that I'm implementing as the GSoC contributor (part of the project skeleton under #18479), so it's already assigned to me and the implementation is up in #39141 — that answers both your questions:
- Watermark fan-out: there's a broadcast partitioner on the repartition sink that sends the watermark report to all partitions; GroupByKeyProcessor feeds those into the existing WatermarkManager and fires the groups once when the watermark reaches TIMESTAMP_MAX. So no change to WatermarkManager itself — the broadcast happens at the sink + the processor handles propagation.
- Repartition topic: for now it's expected to pre-exist (same assumption as the Impulse bootstrap topic); runner-side auto-creation via AdminClient is a separate follow-up, not part of this issue.
Since this one is inside my GSoC scope, my mentor has asked that these runner sub-issues stay with the GSoC work rather than separate PRs, so I'd ask you to hold off on #39136 here — but please don't let that put you off Beam! There's plenty to dig into; the "good first issue" / "newbie" labels are a great place to start. Thanks for understanding 🙂
Closed via #39141