kl0u commented on a change in pull request #10313: [FLINK-14840] Use Executor 
interface in SQL cli
URL: https://github.com/apache/flink/pull/10313#discussion_r351795561
 
 

 ##########
 File path: 
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/gateway/local/ExecutionContext.java
 ##########
 @@ -468,30 +496,7 @@ public ExecutionConfig getExecutionConfig() {
                        }
                }
 
-               public JobGraph createJobGraph(String name) {
-                       final Pipeline pipeline = createPipeline(name, 
flinkConfig);
-
-                       int parallelism;
-                       if (execEnv != null) {
-                               parallelism = execEnv.getParallelism();
-                       } else if (streamExecEnv != null) {
-                               parallelism = streamExecEnv.getParallelism();
-                       } else {
-                               throw new RuntimeException("No execution 
environment defined.");
-                       }
-                       JobGraph jobGraph = 
FlinkPipelineTranslationUtil.getJobGraph(
-                                       pipeline,
-                                       flinkConfig,
-                                       parallelism);
-
-                       jobGraph.addJars(executionParameters.getJars());
-                       
jobGraph.setClasspaths(executionParameters.getClasspaths());
-                       
jobGraph.setSavepointRestoreSettings(executionParameters.getSavepointRestoreSettings());
-
-                       return jobGraph;
-               }
-
-               private Pipeline createPipeline(String name, Configuration 
flinkConfig) {
+               public Pipeline createPipeline(String name, Configuration 
flinkConfig) {
 
 Review comment:
   In this method it seems we do not use the `flinkConfig` or the `parallelism` 
in  the `else` branch. Is it ok to remove them? Also the `else` is not needed 
as we `return` in the `if` branch. So this can become: 
   ```
   public Pipeline createPipeline(String name) {
                        if (streamExecEnv != null) {
                                // special case for Blink planner to apply 
batch optimizations
                                // note: it also modifies the ExecutionConfig!
                                if (executor instanceof ExecutorBase) {
                                        return ((ExecutorBase) 
executor).getStreamGraph(name);
                                }
                                return streamExecEnv.getStreamGraph(name);
                        }
                        return execEnv.createProgramPlan(name);
                }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to