其他分享
首页 > 其他分享> > flink The parallelism of non parallel operator must be 1

flink The parallelism of non parallel operator must be 1

作者:互联网

flink学习过程中遇到The parallelism of non parallel operator must be 1问题

Exception in thread "main" java.lang.IllegalArgumentException: The parallelism of non parallel operator must be 1.
    at org.apache.flink.util.Preconditions.checkArgument(Preconditions.java:138)
    at org.apache.flink.api.common.operators.util.OperatorValidationUtils.validateParallelism(OperatorValidationUtils.java:35)
    at org.apache.flink.streaming.api.datastream.DataStreamSource.setParallelism(DataStreamSource.java:114)
    at com.cdc.Test.main(Test.java:13)

 代码如下,设置了自定义数据源并且不小心设置了并行度为2:

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class Test {
    public static void main(String[] args) throws Exception {
        //获取Flink的运行环境
        StreamExecutionEnvironment env = StreamExecutionEnvi

标签:non,java,flink,streaming,api,parallelism,apache,org
来源: https://blog.csdn.net/sinat_23225111/article/details/122846156