).环境 Flink1.7.2 WordCount local,流处理
).source 中 RecordWriter.emit(),给每个元素按key,分到不同的partition,已确定每个元素的分区位置,分区个数由 
DataStream.setParallelism(2)决定
                
                public void emit(T record) throws IOException, 
InterruptedException {
                   emit(record, channelSelector.selectChannels(record, 
numChannels));
        }
        
        通过copyFromSerializerToTargetChannel(int targetChannel) 
往不同的通道写数据,就是往不同的分区对应的window发送数据(数据是一条一条发送)
).有多少个并行度,DataStream.setParallelism(2)  ,就开启多少个Window
                        

回复