pyflink.datastream.data_stream.DataStream.broadcast#
- DataStream.broadcast() pyflink.datastream.data_stream.DataStream [source]#
- DataStream.broadcast(broadcast_state_descriptor: pyflink.datastream.state.MapStateDescriptor, *other_broadcast_state_descriptors: pyflink.datastream.state.MapStateDescriptor) pyflink.datastream.data_stream.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 aBroadcastStream
withBroadcastState
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