class MapStateImplWithTTL[K, V] extends CompositeKeyTTLStateImpl with MapState[K, V] with Logging
Class that provides a concrete implementation for map state associated with state variables (with ttl expiration support) used in the streaming transformWithState operator.
- K
- type of key for map state variable
- V
- type of value for map state variable
- returns
- instance of MapState of type [K,V] that can be used to store state persistently
- Alphabetic
- By Inheritance
- MapStateImplWithTTL
- Logging
- MapState
- Serializable
- CompositeKeyTTLStateImpl
- TTLState
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new MapStateImplWithTTL(store: StateStore, stateName: String, keyExprEnc: ExpressionEncoder[Any], userKeyEnc: Encoder[K], valEncoder: Encoder[V], ttlConfig: TTLConfig, batchTimestampMs: Long)
- store
- reference to the StateStore instance to be used for storing state
- stateName
- name of the state variable
- keyExprEnc
- Spark SQL encoder for key
- userKeyEnc
- Spark SQL encoder for the map key
- valEncoder
- SQL encoder for state variable
- ttlConfig
- the ttl configuration (time to live duration etc.)
- batchTimestampMs
- current batch processing timestamp.
Type Members
- implicit class LogStringContext extends AnyRef
- Definition Classes
- Logging
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clear(): Unit
Remove this state.
Remove this state.
- Definition Classes
- MapStateImplWithTTL → MapState
- def clearExpiredState(): Long
Clears any state which has ttl older than ttlExpirationMs.
Clears any state which has ttl older than ttlExpirationMs.
- returns
number of values cleaned up.
- Definition Classes
- CompositeKeyTTLStateImpl → TTLState
- def clearIfExpired(groupingKey: Array[Byte], userKey: Array[Byte]): Long
Clears the user state associated with this grouping key if it has expired.
Clears the user state associated with this grouping key if it has expired. This function is called by Spark to perform cleanup at the end of transformWithState processing.
Spark uses a secondary index to determine if the user state for this grouping key has expired. However, its possible that the user has updated the TTL and secondary index is out of date. Implementations must validate that the user State has actually expired before cleanup based on their own State data.
- groupingKey
grouping key for which cleanup should be performed.
- userKey
user key for which cleanup should be performed.
- Definition Classes
- MapStateImplWithTTL → CompositeKeyTTLStateImpl
- def clearTTLState(): Unit
- Definition Classes
- CompositeKeyTTLStateImpl
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- def containsKey(key: K): Boolean
Check if the user key is contained in the map
Check if the user key is contained in the map
- Definition Classes
- MapStateImplWithTTL → MapState
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def exists(): Boolean
Whether state exists or not.
Whether state exists or not.
- Definition Classes
- MapStateImplWithTTL → MapState
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def getValue(key: K): V
Get the state value if it exists
Get the state value if it exists
- Definition Classes
- MapStateImplWithTTL → MapState
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean
- Attributes
- protected
- Definition Classes
- Logging
- def initializeLogIfNecessary(isInterpreter: Boolean): Unit
- Attributes
- protected
- Definition Classes
- Logging
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isTraceEnabled(): Boolean
- Attributes
- protected
- Definition Classes
- Logging
- def iterator(): Iterator[(K, V)]
Get the map associated with grouping key
Get the map associated with grouping key
- Definition Classes
- MapStateImplWithTTL → MapState
- def keys(): Iterator[K]
Get the list of keys present in map associated with grouping key
Get the list of keys present in map associated with grouping key
- Definition Classes
- MapStateImplWithTTL → MapState
- def log: Logger
- Attributes
- protected
- Definition Classes
- Logging
- def logDebug(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logDebug(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logDebug(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logDebug(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logError(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logError(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logError(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logError(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logInfo(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logInfo(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logInfo(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logInfo(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logName: String
- Attributes
- protected
- Definition Classes
- Logging
- def logTrace(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logTrace(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logTrace(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logTrace(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logWarning(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logWarning(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logWarning(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logWarning(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- def removeKey(key: K): Unit
Remove user key from map state
Remove user key from map state
- Definition Classes
- MapStateImplWithTTL → MapState
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def updateValue(key: K, value: V): Unit
Update value for given user key
Update value for given user key
- Definition Classes
- MapStateImplWithTTL → MapState
- def upsertTTLForStateKey(expirationMs: Long, groupingKey: Array[Byte], userKey: Array[Byte]): Unit
- Definition Classes
- CompositeKeyTTLStateImpl
- def values(): Iterator[V]
Get the list of values present in map associated with grouping key
Get the list of values present in map associated with grouping key
- Definition Classes
- MapStateImplWithTTL → MapState
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def withLogContext(context: HashMap[String, String])(body: => Unit): Unit
- Attributes
- protected
- Definition Classes
- Logging
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)