hackergin commented on code in PR #25730:
URL: https://github.com/apache/flink/pull/25730#discussion_r1886088606


##########
flink-table/flink-sql-gateway/src/main/java/org/apache/flink/table/gateway/service/SqlGatewayServiceImpl.java:
##########
@@ -330,6 +336,41 @@ public OperationHandle refreshMaterializedTable(
         }
     }
 
+    @Override
+    public <ClusterID> ClusterID deployScript(
+            SessionHandle sessionHandle,
+            @Nullable Path scriptPath,
+            @Nullable String script,
+            Configuration executionConfig)
+            throws SqlGatewayException {
+        Session session = sessionManager.getSession(sessionHandle);
+        if (scriptPath == null && script == null) {
+            throw new IllegalArgumentException("Please specify script path or 
script.");
+        }
+        Configuration mergedConfig = 
Configuration.fromMap(session.getSessionConfig());
+        mergedConfig.addAll(executionConfig);
+
+        List<String> arguments = new ArrayList<>();
+        if (scriptPath != null) {
+            arguments.add("--" + SqlDriver.OPTION_SQL_FILE.getLongOpt());
+            arguments.add(scriptPath.toString());
+        }
+        if (script != null) {
+            arguments.add("--" + SqlDriver.OPTION_SQL_SCRIPT.getLongOpt());
+            arguments.add(script);
+        }
+
+        ApplicationConfiguration applicationConfiguration =
+                new ApplicationConfiguration(
+                        arguments.toArray(new String[0]), 
SqlDriver.class.getName());
+        try {
+            return new ApplicationClusterDeployer(new 
DefaultClusterClientServiceLoader())
+                    .run(mergedConfig, applicationConfiguration);
+        } catch (Exception e) {
+            throw new SqlGatewayException(e);

Review Comment:
   Consider using log.error to log the details before throwing an exception and 
including relevant context information in the exception message. This would 
ensure consistency with other functions and facilitate troubleshooting



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