Yun Gao created FLINK-23158: ------------------------------- Summary: Source transformation is not added to the StreamExecutionEnvironment explicitly Key: FLINK-23158 URL: https://issues.apache.org/jira/browse/FLINK-23158 Project: Flink Issue Type: Bug Components: API / DataStream Affects Versions: 1.14.0 Reporter: Yun Gao
Currently for the implementation of `StreamExecutionEnvironment#fromSource()` and `StreamExecutionEnvironment#addSource()`, the SourceTransformation is not added to the transformation list explicitly, this make the job with a single source could not run directly. For example, {code:java} StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); env.addSource(new SourceFunction<String>() { @Override public void run(SourceContext<String> sourceContext) throws Exception { } @Override public void cancel() { } }); env.execute(); {code} would throws the exception: {code:java} Exception in thread "main" java.lang.IllegalStateException: No operators defined in streaming topology. Cannot execute. at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.getStreamGraphGenerator(StreamExecutionEnvironment.java:2019) at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.getStreamGraph(StreamExecutionEnvironment.java:2010) at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.getStreamGraph(StreamExecutionEnvironment.java:1995) at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1834) at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1817) at test.SingleSourceTest.main(SingleSourceTest.java:41) {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)