Flink分区的方式决定了上游subtask的数据是如何流向下游subtask的,目前Flink提供了共8种分区算子,每个都对应着各自具体的分区器,可以见DataStream类里的方法shuffle、rebalance、rescale、keyBy、global、forward、broadcast、partitionCustom方法。以上方法除了keyBy返回的是KeyedStream,其他的都还是返回DataStream。
各个算子对应的分区器如下:
| 算子 | 分区器 | 
| shuffle | ShufflePartitioner | 
| rebalance | RebalancePartitioner | 
| rescale | RescalePartitioner | 
| keyBy | KeyGroupStreamPartitioner | 
| global | GlobalPartitioner | 
| forward | ForwardPartitioner | 
| broadcast | BroadcastPartitioner | 
| partitionCustom | CustomPartitionerWrapper< |