split和side-output分流源码分析
在日常开发中,我们常常需要对数据流进行拆分处理,flink提供了split/side output方式进行分流(filter分流方式使用场景有限,不作讨论)。首先,同一个流上不能同时使用split和side-output进行分流。否则,会抛出如下异常:
throw new UnsupportedOperationException("getSideOutput() and split() may not be called on the same DataStream. " +
"As a work-around, please add a no-op map function before the split() call.");
split分流源码分析
@Override
public SplitStream<T> split(OutputSelector<T> outputSelector) {
if (requestedSideOutputs.isEmpty()) {
wasSplitApplied = true;
return super.split(outputSelector);
} else