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.data_stream.CachedDataStream.broadcast#

CachedDataStream.broadcast(broadcast_state_descriptor: Optional[MapStateDescriptor] = None, *other_broadcast_state_descriptors: MapStateDescriptor) → Union[DataStream, BroadcastStream]#

Sets the partitioning of the DataStream so that the output elements are broadcasted to every parallel instance of the next operation.

If MapStateDescriptor s are passed in, it returns a BroadcastStream with BroadcastState s implicitly created as the descriptors specified.

Example:

>>> map_state_desc1 = MapStateDescriptor("state1", Types.INT(), Types.INT())
>>> map_state_desc2 = MapStateDescriptor("state2", Types.INT(), Types.STRING())
>>> broadcast_stream = ds1.broadcast(map_state_desc1, map_state_desc2)
>>> broadcast_connected_stream = ds2.connect(broadcast_stream)
Parameters
  • broadcast_state_descriptor – the first MapStateDescriptor describing BroadcastState.

  • other_broadcast_state_descriptors – the rest of MapStateDescriptors describing BroadcastStates, if any.

Returns

The DataStream with broadcast partitioning set or a BroadcastStream which can be used in connect() to create a BroadcastConnectedStream for further processing of the elements.

Changed in version 1.16.0: Support return BroadcastStream

previous

pyflink.datastream.data_stream.CachedDataStream.forward

next

pyflink.datastream.data_stream.CachedDataStream.process

On this page
  • CachedDataStream.broadcast()
Show Source

Created using Sphinx 5.3.0.