KeyValueGroupedDataset[K, V].flatMapGroupsWithState[S: Encoder, U: Encoder](
outputMode: OutputMode,
timeoutConf: GroupStateTimeout)(
func: (K, Iterator[V], GroupState[S]) => Iterator[U]): Dataset[U]
flatMapGroupsWithState Operator — Arbitrary Stateful Streaming Aggregation (with Explicit State Logic)
flatMapGroupsWithState
operator is used for Arbitrary Stateful Streaming Aggregation (with Explicit State Logic).
flatMapGroupsWithState
requires that the given OutputMode is either Append or Update (and reports an IllegalArgumentException
at runtime).
Note
|
An OutputMode is a required argument, but does not seem to be used at all. Check out the question What’s the purpose of OutputMode in flatMapGroupsWithState? How/where is it used? on StackOverflow.
|
Every time the state function func
is executed for a key, the state (as GroupState[S]
) is for this key only.
Note
|
|
Internally, flatMapGroupsWithState
creates a new Dataset
with FlatMapGroupsWithState unary logical operator.