yuzelin commented on code in PR #21187:
URL: https://github.com/apache/flink/pull/21187#discussion_r1046600266


##########
flink-table/flink-sql-gateway/src/main/java/org/apache/flink/table/gateway/service/operation/OperationExecutor.java:
##########
@@ -144,19 +145,29 @@ public ResultFetcher executeStatement(OperationHandle 
handle, String statement)
                             + "multiple 'INSERT INTO' statements wrapped in a 
'STATEMENT SET' block.");
         }
         Operation op = parsedOperations.get(0);
+        validate(op);
+
         if (op instanceof SetOperation) {
             return callSetOperation(tableEnv, handle, (SetOperation) op);
         } else if (op instanceof ResetOperation) {
             return callResetOperation(handle, (ResetOperation) op);
         } else if (op instanceof BeginStatementSetOperation) {
-            // TODO: support statement set in the FLINK-27837
-            throw new UnsupportedOperationException();
+            return callBeginStatementSetOperation(handle);
         } else if (op instanceof EndStatementSetOperation) {
-            // TODO: support statement set in the FLINK-27837
-            throw new UnsupportedOperationException();
+            return callEndStatementSetOperation(tableEnv, handle);
         } else if (op instanceof ModifyOperation) {
-            return callModifyOperations(
-                    tableEnv, handle, 
Collections.singletonList((ModifyOperation) op));
+            if (sessionContext.isStatementSetState()) {
+                // collect ModifyOperation to Statement Set
+                sessionContext.addStatementSetOperation((ModifyOperation) op);
+                return new ResultFetcher(
+                        handle,
+                        
TableResultInternal.TABLE_RESULT_OK.getResolvedSchema(),
+                        CollectionUtil.iteratorToList(
+                                
TableResultInternal.TABLE_RESULT_OK.collectInternal()));
+            } else {
+                return callModifyOperations(
+                        tableEnv, handle, 
Collections.singletonList((ModifyOperation) op));
+            }

Review Comment:
   Improved.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to