You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/11/14 16:45:00 UTC

[GitHub] [flink] jnh5y commented on a diff in pull request #21133: [FLINK-29732][sql-gateway] support configuring session with SQL statement.

jnh5y commented on code in PR #21133:
URL: https://github.com/apache/flink/pull/21133#discussion_r1021808704


##########
flink-table/flink-sql-gateway/src/main/java/org/apache/flink/table/gateway/service/operation/OperationExecutor.java:
##########
@@ -84,6 +90,30 @@ public OperationExecutor(SessionContext context, Configuration executionConfig)
         this.executionConfig = executionConfig;
     }
 
+    public ResultFetcher configureSession(OperationHandle handle, String statement) {
+        TableEnvironmentInternal tableEnv = getTableEnvironment();
+        List<Operation> parsedOperations = tableEnv.getParser().parse(statement);
+        if (parsedOperations.size() > 1) {
+            throw new UnsupportedOperationException(
+                    "Unsupported SQL statement! Execute statement only accepts a single SQL statement or "
+                            + "multiple 'INSERT INTO' statements wrapped in a 'STATEMENT SET' block.");
+        }
+        Operation op = parsedOperations.get(0);
+        if (!(op instanceof SetOperation)
+                && !(op instanceof ResetOperation)
+                && !(op instanceof CreateOperation)
+                && !(op instanceof DropOperation)
+                && !(op instanceof UseOperation)
+                && !(op instanceof AlterOperation)
+                && !(op instanceof LoadModuleOperation)
+                && !(op instanceof UnloadModuleOperation)
+                && !(op instanceof AddJarOperation)) {

Review Comment:
   Should RemoveJarOperation be in the this list?



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org