Skip to content


StateManagerImplBase is the <> of the <> for <> of FlatMapGroupsWithStateExec physical operator with the following features:

  • Use Catalyst expressions for <> and <>

  • Use <> when <> with the <> flag on

[[contract]] .StateManagerImplBase Contract (Abstract Methods Only) [cols="30m,70",options="header",width="100%"] |=== | Method | Description

| stateDeserializerExpr a| [[stateDeserializerExpr]]

[source, scala]

stateDeserializerExpr: Expression

State deserializer, i.e. a Catalyst expression to deserialize a state object from a row (UnsafeRow)

Used exclusively for the <>

| stateSerializerExprs a| [[stateSerializerExprs]]

[source, scala]

stateSerializerExprs: Seq[Expression]

State serializer, i.e. Catalyst expressions to serialize a state object to a row (UnsafeRow)

Used exclusively for the <>

| timeoutTimestampOrdinalInRow a| [[timeoutTimestampOrdinalInRow]]

[source, scala]

timeoutTimestampOrdinalInRow: Int

Position of the timeout timestamp in a state row

Used when StateManagerImplBase is requested to <> and <>


[[implementations]] .StateManagerImplBases [cols="30,70",options="header",width="100%"] |=== | StateManagerImplBase | Description

| <> | [[StateManagerImplV1]] Legacy <>

| <> | [[StateManagerImplV2]] Default <>


=== [[creating-instance]][[shouldStoreTimestamp]] Creating StateManagerImplBase Instance

StateManagerImplBase takes a single shouldStoreTimestamp flag to be created (that is set when the <> are created).

NOTE: StateManagerImplBase is a Scala abstract class and cannot be <> directly. It is created indirectly for the <>.

StateManagerImplBase initializes the <>.

=== [[getState]] Getting State Data for Key from StateStore -- getState Method

[source, scala]

getState( store: StateStore, keyRow: UnsafeRow): StateData

getState is part of the StateManager abstraction.


=== [[putState]] Persisting State Value for Key in StateStore -- putState Method

[source, scala]

putState( store: StateStore, key: UnsafeRow, state: Any, timestamp: Long): Unit

putState is part of the StateManager abstraction.


=== [[removeState]] Removing State for Key from StateStore -- removeState Method

[source, scala]

removeState( store: StateStore, keyRow: UnsafeRow): Unit

removeState is part of the StateManager abstraction.


=== [[getAllState]] Getting All State Data (for All Keys) from StateStore -- getAllState Method

[source, scala]

getAllState(store: StateStore): Iterator[StateData]

getAllState is part of the StateManager abstraction.


=== [[getStateObject]] getStateObject Internal Method

[source, scala]

getStateObject(row: UnsafeRow): Any


getStateObject is used when...FIXME

=== [[getStateRow]] getStateRow Internal Method

[source, scala]

getStateRow(obj: Any): UnsafeRow


getStateRow is used when...FIXME

=== [[getTimestamp]] Getting Timeout Timestamp (from State Row) -- getTimestamp Internal Method

[source, scala]

getTimestamp(stateRow: UnsafeRow): Long


getTimestamp is used when...FIXME

=== [[setTimestamp]] Setting Timeout Timestamp (to State Row) -- setTimestamp Internal Method

[source, scala]

setTimestamp( stateRow: UnsafeRow, timeoutTimestamps: Long): Unit


setTimestamp is used when...FIXME

=== [[internal-properties]] Internal Properties

[cols="30m,70",options="header",width="100%"] |=== | Name | Description

| stateSerializerFunc a| [[stateSerializerFunc]] State object serializer (of type Any => UnsafeRow) to serialize a state object (for a per-group state key) to a row (UnsafeRow)

  • The serialization expression (incl. the type) is specified as the <>

Used exclusively in <>

| stateDeserializerFunc a| [[stateDeserializerFunc]] State object deserializer (of type InternalRow => Any) to deserialize a row (for a per-group state value) to a Scala value

  • The deserialization expression (incl. the type) is specified as the <>

Used exclusively in <>

| stateDataForGets a| [[stateDataForGets]] Empty StateData to share (reuse) between <> calls (to avoid high use of memory with many StateData objects)