Expand description
KGroupedStream<K,V>: the handle between a group op and an aggregation.
The group ops are groupByKey and groupBy. The terminal aggregations are
count, reduce, and aggregate.
groupByKey and groupBy record no graph node. They capture four things:
whether the upstream was key-changing, the optional Grouped name, the value
serdes for the repartition topic, and a typed repartition-lowering thunk. The
terminal aggregation then does three steps:
- It mints the store name at the JVM counter position. The name comes
from
Materialized, or from a freshKSTREAM-AGGREGATE-STATE-STORE-orKSTREAM-REDUCE-STATE-STORE-counter. - If the upstream is key-changing, it records a
Repartitionnode. That node’s thunk lowerssink → add_repartition_topic → source, so the runtime re-groups records by key before the aggregation. This splits the topology into 2 subtopologies. - It records an
Aggregatenode whose thunk adds the aggregation processor and its state store.
Repartition and changelog topic names follow the JVM naming rules, so the
client can send the built topology through StreamsGroupHeartbeat.
Structs§
- KGrouped
Stream - Handle produced by
groupByKeyandgroupBy. A terminal aggregation consumes it.