问题描述/异常栈

2021-12-16 11:23:53,918 ERROR org.apache.flink.client.cli.CliFrontend                      [] - Error while running the command.
org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: No operators defined in streaming topology. Cannot generate StreamGraph.
    at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:366) ~[flink-dist_2.12-ne-flink-1.12.4-1.1.3.jar:ne-flink-1.12.4-1.1.3]
    at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:219) ~[flink-dist_2.12-ne-flink-1.12.4-1.1.3.jar:ne-flink-1.12.4-1.1.3]
    at org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:117) ~[flink-dist_2.12-ne-flink-1.12.4-1.1.3.jar:ne-flink-1.12.4-1.1.3]
    at org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:812) ~[flink-dist_2.12-ne-flink-1.12.4-1.1.3.jar:ne-flink-1.12.4-1.1.3]
    at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:246) ~[flink-dist_2.12-ne-flink-1.12.4-1.1.3.jar:ne-flink-1.12.4-1.1.3]
    at org.apache.flink.client.cli.CliFrontend.parseAndRun(CliFrontend.java:1054) ~[flink-dist_2.12-ne-flink-1.12.4-1.1.3.jar:ne-flink-1.12.4-1.1.3]
    at org.apache.flink.client.cli.CliFrontend.lambda$main$10(CliFrontend.java:1132) ~[flink-dist_2.12-ne-flink-1.12.4-1.1.3.jar:ne-flink-1.12.4-1.1.3]
    at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_131]
    at javax.security.auth.Subject.doAs(Subject.java:422) [?:1.8.0_131]
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1754) [flink-shaded-hadoop-2-uber-2.7.5-10.0.jar:2.7.5-10.0]
    at org.apache.flink.runtime.security.contexts.HadoopSecurityContext.runSecured(HadoopSecurityContext.java:41) [flink-dist_2.12-ne-flink-1.12.4-1.1.3.jar:ne-flink-1.12.4-1.1.3]
    at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1132) [flink-dist_2.12-ne-flink-1.12.4-1.1.3.jar:ne-flink-1.12.4-1.1.3]
Caused by: java.lang.IllegalStateException: No operators defined in streaming topology. Cannot generate StreamGraph.
    at org.apache.flink.table.planner.utils.ExecutorUtils.generateStreamGraph(ExecutorUtils.java:41) ~[flink-table-blink_2.12-ne-flink-1.12.4-1.1.3.jar:ne-flink-1.12.4-1.1.3]
    at org.apache.flink.table.planner.delegation.StreamExecutor.createPipeline(StreamExecutor.java:50) ~[flink-table-blink_2.12-ne-flink-1.12.4-1.1.3.jar:ne-flink-1.12.4-1.1.3]
    at com.netease.sloth.flink112.sql.table.FlinkTableEnvironmentImpl.execute(FlinkTableEnvironmentImpl.java:306) ~[?:?]
    at com.netease.sloth.flink.sql.planner.SlothJobExecutor.execute(SlothJobExecutor.java:178) ~[?:?]
    at com.netease.sloth.flink.sql.executor.BaseFlinkNotebookExecutor.execute(BaseFlinkNotebookExecutor.java:38) ~[?:?]
    at com.netease.sloth.flink.sql.NotebookEntryPoint.main(NotebookEntryPoint.java:44) ~[?:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_131]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131]
    at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:349) ~[flink-dist_2.12-ne-flink-1.12.4-1.1.3.jar:ne-flink-1.12.4-1.1.3]
    ... 11 more

解决方案

添加INSERT语句构成闭环。

问题原因

多为任务中没有写DMLINSERT)语句导致。

作者:邓崃翔