目录
全局分区器GlobalPartitioner
广播分区器BroadcastPartitioner
哈希分区器BinaryHashPartitioner
轮询分区器RebalancePartitioner
重缩放分区器RescalePartitioner
随机分区器ShufflePartitioner
转发分区器ForwardPartitioner
键组分区器KeyGroupStreamPartitioner
自定义分区器CustomPartitionerWrapper
Flink提供了八种分区策略为上游DataStream中数据如何分发到下游DataStream中提供了分发策略。八种分发策略分别如下:
(1)全局分区器GlobalPartitioner
(2)广播分区器BroadcastPartitioner
(3)哈希分区器BinaryHashPartitioner
(4)重缩放分区器RescalePartitioner
(5)轮询分区器RebalancePartitioner
(6)随机分区器ShufflePartitioner
(7)转发分区器ForwardPartitioner
(8)键组分区器KeyGroupStreamPartitioner
(9)自定义分区器CustomPartitionerWrapper
各个分区器的继承关系如下:
各分区器的类定义如下:
// 流分区抽象类.
public abstract class StreamPartitioner<T> implements ChannelSelector<SerializationDelegate<StreamRecord<T>>>, Serializable
// 全局分区类.
public class GlobalPartitioner<T>