mapGroupsWithState
(Kotlin-specific) Applies the given function to each group of data, while maintaining a user-defined per-group state. The result Dataset will represent the objects returned by the function. For a static batch Dataset, the function will be invoked once per group. For a streaming Dataset, the function will be invoked for each group repeatedly in every trigger, and updates to each group's state will be saved across invocations. See org.apache.spark.sql.streaming.GroupState for more details.
Parameters
The type of the user-defined state. Must be encodable to Spark SQL types.
The type of the output objects. Must be encodable to Spark SQL types.
Function to be called on every group.
See Encoder for more details on what types are encodable to Spark SQL.
(Kotlin-specific) Applies the given function to each group of data, while maintaining a user-defined per-group state. The result Dataset will represent the objects returned by the function. For a static batch Dataset, the function will be invoked once per group. For a streaming Dataset, the function will be invoked for each group repeatedly in every trigger, and updates to each group's state will be saved across invocations. See org.apache.spark.sql.streaming.GroupState for more details.
Parameters
The type of the user-defined state. Must be encodable to Spark SQL types.
The type of the output objects. Must be encodable to Spark SQL types.
Function to be called on every group.
Timeout configuration for groups that do not receive data for a while.
See Encoder for more details on what types are encodable to Spark SQL.