Ctrl+K
Logo image Logo image

Site Navigation

  • API Reference
  • Examples

Site Navigation

  • API Reference
  • Examples

Section Navigation

  • PyFlink Table
  • PyFlink DataStream
    • StreamExecutionEnvironment
    • DataStream
    • Functions
    • State
    • Timer
    • Window
    • Checkpoint
    • Side Outputs
    • Connectors
    • Formats
  • PyFlink Common

pyflink.datastream.functions.KeyedCoProcessFunction#

class KeyedCoProcessFunction[source]#

A function that processes elements of two keyed streams and produces a single output one.

The function will be called for every element in the input streams and can produce zero or more output elements. Contrary to the CoFlatMapFunction, this function can also query the time (both event and processing) and set timers, through the provided {@link Context}. When reacting to the firing of set timers the function can emit yet more elements.

An example use-case for connected streams would be the application of a set of rules that change over time ({@code stream A}) to the elements contained in another stream (stream {@code B}). The rules contained in {@code stream A} can be stored in the state and wait for new elements to arrive on {@code stream B}. Upon reception of a new element on {@code stream B}, the function can now apply the previously stored rules to the element and directly emit a result, and/or register a timer that will trigger an action in the future.

Methods

close()

on_timer(timestamp, ctx)

Called when a timer set using TimerService fires.

open(runtime_context)

process_element1(value, ctx)

Process one element from the input stream.

process_element2(value, ctx)

Process one element from the input stream.

previous

pyflink.datastream.functions.CoProcessFunction

next

pyflink.datastream.functions.WindowFunction

Show Source

Created using Sphinx 4.5.0.