godfreyhe commented on a change in pull request #11296: [FLINK-16363] [table] 
Correct the execution behavior of TableEnvironment and StreamTableEnvironment
URL: https://github.com/apache/flink/pull/11296#discussion_r388912855
 
 

 ##########
 File path: 
flink-table/flink-table-api-java-bridge/src/main/java/org/apache/flink/table/api/java/internal/StreamTableEnvironmentImpl.java
 ##########
 @@ -357,6 +361,26 @@ public StreamExecutionEnvironment execEnv() {
                return executionEnvironment;
        }
 
+       /**
+        * This method is used for sql client to submit job.
+        */
+       public Pipeline getPipeline(String jobName) {
+               return execEnv.createPipeline(translate(), tableConfig, 
jobName);
+       }
+
+       @Override
+       protected List<Transformation<?>> translate(List<ModifyOperation> 
modifyOperations) {
+               // keep the behavior as before: translate each operation 
independently
+               List<Transformation<?>> transformations = new 
ArrayList<>(modifyOperations.size());
+               for (ModifyOperation operation : modifyOperations) {
+                       List<Transformation<?>> transformationList = 
planner.translate(Collections.singletonList(operation));
+                       Preconditions.checkArgument(transformationList.size() 
== 1,
+                               "expected size is 1, actual size is " + 
transformationList.size());
+                       transformations.add(transformationList.get(0));
+               }
 
 Review comment:
   agree with you. we disable multi-sink optimization in 
`StreamTableEnvironmentImpl` before because `StreamExecutionEnvironment` can 
also trigger the table program (generated by `StreamTableEnvironmentImpl`) and 
DataStream program. Now `StreamExecutionEnvironment` can only trigger 
DataStream program, `StreamTableEnvironmentImpl ` can also support multi-sink 
optimization. `StreamTableEnvironmentImpl`  supports full functionality, 
including all kinds of UDFs registration, to/from DataStream, multi-sink 
optimization.

----------------------------------------------------------------
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