KurtYoung commented on a change in pull request #12042:
URL: https://github.com/apache/flink/pull/12042#discussion_r422157743



##########
File path: 
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableEnvironmentImpl.java
##########
@@ -654,13 +655,39 @@ public TableResult executeSql(String statement) {
                return executeOperation(operations.get(0));
        }
 
+       @Override
+       public StatementSet createStatementSet() {
+               return new StatementSetImpl(this);
+       }
+
        @Override
        public TableResult executeInternal(List<ModifyOperation> operations) {
-               if (operations.size() != 1) {
-                       throw new TableException("Only one ModifyOperation is 
supported now.");
-               }
+               List<Transformation<?>> transformations = translate(operations);
+               String jobName = extractJobName(operations);
+               Pipeline pipeline = execEnv.createPipeline(transformations, 
tableConfig, jobName);
+               try {
+                       JobClient jobClient = execEnv.executeAsync(pipeline);
+                       TableSchema.Builder builder = TableSchema.builder();
+                       Object[] affectedRowCounts = new 
Long[operations.size()];
+                       for (int i = 0; i < operations.size(); ++i) {
+                               // if only one operation, field name is 
'affected_rowcount', else is 'affected_rowcount_$i'
+                               String fieldName = "affected_rowcount";

Review comment:
       how about using the target table name as the column name?

##########
File path: 
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/StatementSetImpl.java
##########
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.api.internal;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.table.api.ExplainDetail;
+import org.apache.flink.table.api.StatementSet;
+import org.apache.flink.table.api.Table;
+import org.apache.flink.table.api.TableException;
+import org.apache.flink.table.api.TableResult;
+import org.apache.flink.table.catalog.ObjectIdentifier;
+import org.apache.flink.table.catalog.UnresolvedIdentifier;
+import org.apache.flink.table.operations.CatalogSinkModifyOperation;
+import org.apache.flink.table.operations.ModifyOperation;
+import org.apache.flink.table.operations.Operation;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * Implementation for {@link StatementSet}.
+ */
+@Internal
+class StatementSetImpl implements StatementSet {
+       private List<ModifyOperation> operations = new ArrayList<>();
+       private final TableEnvironmentInternal tableEnvironment;

Review comment:
       move this before `operations`




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


Reply via email to