Packages

c

org.apache.spark.sql.streaming

StatefulProcessor

abstract class StatefulProcessor[K, I, O] extends Serializable

Represents the arbitrary stateful logic that needs to be provided by the user to perform stateful manipulations on keyed streams.

Users can also explicitly use import implicits._ to access the EncoderImplicits and use the state variable APIs relying on implicit encoders.

Annotations
@Evolving()
Source
StatefulProcessor.scala
Linear Supertypes
Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. StatefulProcessor
  2. Serializable
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new StatefulProcessor()

Abstract Value Members

  1. abstract def handleInputRows(key: K, inputRows: Iterator[I], timerValues: TimerValues): Iterator[O]

    Function that will allow users to interact with input data rows along with the grouping key and current timer values and optionally provide output rows.

    Function that will allow users to interact with input data rows along with the grouping key and current timer values and optionally provide output rows.

    Note that in microbatch mode, input rows for a given grouping key will be provided in a single function invocation. If the grouping key is not seen in the current microbatch, this function will not be invoked for that key.

    key

    \- grouping key

    inputRows

    \- iterator of input rows associated with grouping key

    timerValues

    \- instance of TimerValues that provides access to current processing/event time if available

    returns

    \- Zero or more output rows

  2. abstract def init(outputMode: OutputMode, timeMode: TimeMode): Unit

    Function that will be invoked as the first method that allows for users to initialize all their state variables and perform other init actions before handling data.

    Function that will be invoked as the first method that allows for users to initialize all their state variables and perform other init actions before handling data.

    outputMode

    \- output mode for the stateful processor

    timeMode

    \- time mode for the stateful processor.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  6. def close(): Unit

    Function called as the last method that allows for users to perform any cleanup or teardown operations.

  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  9. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  10. final def getHandle: StatefulProcessorHandle

    Function to get the stateful processor handle that will be used to interact with the state

    Function to get the stateful processor handle that will be used to interact with the state

    returns

    handle - instance of StatefulProcessorHandle

  11. def handleExpiredTimer(key: K, timerValues: TimerValues, expiredTimerInfo: ExpiredTimerInfo): Iterator[O]

    Function that will be invoked when a timer is fired for a given key.

    Function that will be invoked when a timer is fired for a given key. Users can choose to evict state, register new timers and optionally provide output rows.

    Note that in microbatch mode, this function will be called once for each unique timer expiry for a given key. If no timer expires for a given key, this function will not be invoked for that key.

    key

    \- grouping key

    timerValues

    \- instance of TimerValues that provides access to current processing/event

    expiredTimerInfo

    \- instance of ExpiredTimerInfo that provides access to expired timer

    returns

    Zero or more output rows

  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  16. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  17. final def setHandle(handle: StatefulProcessorHandle): Unit

    Function to set the stateful processor handle that will be used to interact with the state store and other stateful processor related operations.

    Function to set the stateful processor handle that will be used to interact with the state store and other stateful processor related operations.

    handle

    \- instance of StatefulProcessorHandle

  18. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  19. def toString(): String
    Definition Classes
    AnyRef → Any
  20. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  21. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  22. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  23. object implicits extends EncoderImplicits

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped