StateManager¶
StateManager
is an abstraction of state managers that act as middlemen between state stores and FlatMapGroupsWithStateExec physical operator used in Arbitrary Stateful Streaming Aggregation.
Contract¶
getAllState¶
getAllState(
store: StateStore): Iterator[StateData]
Retrieves all state data (for all keys) from the given StateStore
Used when:
InputProcessor
is requested to processTimedOutState
getState¶
getState(
store: StateStore,
keyRow: UnsafeRow): StateData
Gets the state data for the given key from the given StateStore
Used when:
InputProcessor
is requested to processNewData and processNewDataWithInitialState
putState¶
putState(
store: StateStore,
keyRow: UnsafeRow,
state: Any,
timeoutTimestamp: Long): Unit
Persists (puts) the given state (value) for the given key in the given StateStore
Used when:
InputProcessor
is requested to callFunctionAndUpdateState (right after all rows have been processed)
removeState¶
removeState(
store: StateStore,
keyRow: UnsafeRow): Unit
Removes the state for the given key from the given StateStore
Used when:
InputProcessor
is requested to callFunctionAndUpdateState (right after all rows have been processed)
stateSchema¶
stateSchema: StructType
Used when:
FlatMapGroupsWithStateExec
is requested to executeStateManagerImplBase
is requested for the stateDeserializerFunc