github-advanced-security[bot] commented on code in PR #17201:
URL: 
https://github.com/apache/dolphinscheduler/pull/17201#discussion_r2103269456


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-flink-materialized-table/src/main/java/org/apache/dolphinscheduler/plugin/task/flink/gateway/FlinkSqlClient.java:
##########
@@ -0,0 +1,237 @@
+/*
+ * 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.dolphinscheduler.plugin.task.flink.gateway;
+
+import 
org.apache.dolphinscheduler.plugin.task.flink.gateway.model.FetchResultResponseBody;
+import org.apache.dolphinscheduler.plugin.task.flink.gateway.model.JobStatus;
+import 
org.apache.dolphinscheduler.plugin.task.flink.gateway.model.RefreshMaterializedTableRequest;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import jline.internal.Log;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+/**
+ * Client for interacting with Flink SQL Gateway.
+ */
+public class FlinkSqlClient {
+
+    private static final Logger log = 
LoggerFactory.getLogger(FlinkSqlClient.class);
+
+    private static final int MAX_RETRIES = 30;
+    private static final int RETRY_INTERVAL_SECONDS = 2;
+    private static final ObjectMapper objectMapper = new ObjectMapper();
+
+    private final String baseUrl;
+    private final CloseableHttpClient httpClient;
+
+    /**
+     * Constructs a new FlinkSqlClient with the specified base URL.
+     *
+     * @param baseUrl The base URL of the Flink SQL Gateway
+     */
+    public FlinkSqlClient(String baseUrl) {
+        this.baseUrl = baseUrl;
+        this.httpClient = HttpClients.createDefault();
+    }
+
+    /**
+     * Opens a new session with the Flink SQL Gateway.
+     *
+     * @param config Configuration parameters for the session
+     * @return The session handle
+     * @throws IOException if an I/O error occurs
+     */
+    public String openSession(Map<String, String> config) throws IOException {
+        String url = baseUrl + "/v3/sessions";
+        HttpPost request = new HttpPost(url);
+        request.setHeader("Content-Type", "application/json");
+        if (config != null) {
+            request.setEntity(new 
StringEntity(objectMapper.writeValueAsString(config)));
+        }
+
+        try (CloseableHttpResponse response = httpClient.execute(request)) {
+            HttpEntity entity = response.getEntity();
+            String responseBody = EntityUtils.toString(entity);
+            log.info("open session response: ", responseBody);

Review Comment:
   ## Unused format argument
   
   This format call refers to 0 argument(s) but supplies 1 argument(s).
   
   [Show more 
details](https://github.com/apache/dolphinscheduler/security/code-scanning/5178)



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