Interface BroadcastStream<T>
-
- All Superinterfaces:
DataStream
@Experimental public interface BroadcastStream<T> extends DataStream
This interface represents a stream that each parallel task processes the same data.
-
-
Method Summary
-
-
-
Method Detail
-
connectAndProcess
<K,T_OTHER,OUT> NonKeyedPartitionStream.ProcessConfigurableAndNonKeyedPartitionStream<OUT> connectAndProcess(KeyedPartitionStream<K,T_OTHER> other, TwoInputBroadcastStreamProcessFunction<T_OTHER,T,OUT> processFunction)
Apply a two input operation to this and otherKeyedPartitionStream.Generally, concatenating
BroadcastStreamandKeyedPartitionStreamwill result in aNonKeyedPartitionStream, and you can manually generate aKeyedPartitionStreamvia keyBy partitioning. In some cases, you can guarantee that the partition on which the data is processed will not change, then you can useconnectAndProcess(KeyedPartitionStream, TwoInputBroadcastStreamProcessFunction, KeySelector)to avoid shuffling.- Parameters:
other-KeyedPartitionStreamto perform operation with two input.processFunction- to perform operation.- Returns:
- new stream with this operation.
-
connectAndProcess
<T_OTHER,OUT> NonKeyedPartitionStream.ProcessConfigurableAndNonKeyedPartitionStream<OUT> connectAndProcess(NonKeyedPartitionStream<T_OTHER> other, TwoInputBroadcastStreamProcessFunction<T_OTHER,T,OUT> processFunction)
Apply a two input operation to this and otherNonKeyedPartitionStream.- Parameters:
other-NonKeyedPartitionStreamto perform operation with two input.processFunction- to perform operation.- Returns:
- new stream with this operation.
-
connectAndProcess
<K,T_OTHER,OUT> KeyedPartitionStream.ProcessConfigurableAndKeyedPartitionStream<K,OUT> connectAndProcess(KeyedPartitionStream<K,T_OTHER> other, TwoInputBroadcastStreamProcessFunction<T_OTHER,T,OUT> processFunction, org.apache.flink.api.java.functions.KeySelector<OUT,K> newKeySelector)
Apply a two input operation to this and otherKeyedPartitionStream.This method is used to avoid shuffle after applying the process function. It is required that for the record from non-broadcast input, the new
KeySelectormust extract the same key as the originalKeySelectors on theKeyedPartitionStream. Otherwise, the partition of data will be messy. As for the record from broadcast input, the output key from keyed partition itself instead of the new key selector, so the data it outputs will not affect the partition.- Parameters:
other-KeyedPartitionStreamto perform operation with two input.processFunction- to perform operation.newKeySelector- to select the key after process.- Returns:
- new
KeyedPartitionStreamwith this operation.
-
-