reswqa commented on code in PR #20609: URL: https://github.com/apache/flink/pull/20609#discussion_r951057263
########## flink-end-to-end-tests/flink-sql-gateway-test/pom.xml: ########## @@ -84,6 +90,12 @@ under the License. <artifactId>flink-test-utils-junit</artifactId> </dependency> + <dependency> + <groupId>org.apache.flink</groupId> Review Comment: Why do we need to introduce flink-sql-gateway dependency twice? ########## flink-end-to-end-tests/flink-end-to-end-tests-common/src/main/java/org/apache/flink/tests/util/flink/FlinkDistribution.java: ########## @@ -301,7 +309,105 @@ public void submitSQLJob(SQLJobSubmission job, Duration timeout) throws Exceptio }); new Thread(future).start(); future.get(timeout.toMillis(), TimeUnit.MILLISECONDS); + } else if (job.getClientMode() == SQLJobSubmission.ClientMode.REST) { + FutureTaskWithException<Void> future = + new FutureTaskWithException<>( + () -> { + Map<String, String> configMap = + GlobalConfiguration.loadConfiguration( + conf.toAbsolutePath().toString()) + .toMap(); + String host = + configMap.getOrDefault( + "sql-gateway.endpoint.rest.address", + InetAddress.getByName("localhost") + .getHostAddress()); + String port = + configMap.getOrDefault( + "sql-gateway.endpoint.rest.port", "8083"); + // Open a session + String sessionHandle = openSession(host, port); + List<String> sqlLines = job.getSqlLines(); + for (String sql : sqlLines) { + // Execute statement + String operationHandle = + executeStatement(sessionHandle, sql, host, port); + int count = 5; + while (count > 0) { + TimeUnit.SECONDS.sleep(2); Review Comment: It may not be a good idea to directly sleep for 2 seconds at the beginning. I am worried that this will affect the running time of E2E CI. If we can't think of a good way to deal with this problem, at least we can move the sleep statement after getting the results and reduce the sleep time appropriately. ########## flink-end-to-end-tests/flink-end-to-end-tests-common/src/main/java/org/apache/flink/tests/util/flink/FlinkDistribution.java: ########## @@ -301,7 +309,105 @@ public void submitSQLJob(SQLJobSubmission job, Duration timeout) throws Exceptio }); new Thread(future).start(); future.get(timeout.toMillis(), TimeUnit.MILLISECONDS); + } else if (job.getClientMode() == SQLJobSubmission.ClientMode.REST) { + FutureTaskWithException<Void> future = + new FutureTaskWithException<>( + () -> { + Map<String, String> configMap = + GlobalConfiguration.loadConfiguration( + conf.toAbsolutePath().toString()) + .toMap(); + String host = + configMap.getOrDefault( + "sql-gateway.endpoint.rest.address", + InetAddress.getByName("localhost") + .getHostAddress()); + String port = + configMap.getOrDefault( + "sql-gateway.endpoint.rest.port", "8083"); + // Open a session + String sessionHandle = openSession(host, port); + List<String> sqlLines = job.getSqlLines(); + for (String sql : sqlLines) { + // Execute statement + String operationHandle = + executeStatement(sessionHandle, sql, host, port); + int count = 5; Review Comment: I recommend naming it `retryNumber` ########## flink-table/flink-sql-gateway/src/main/resources/META-INF/services/org.apache.flink.table.factories.Factory: ########## @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -org.apache.flink.table.gateway.rest.SqlGatewayRestEndpointFactory \ No newline at end of file +org.apache.flink.table.gateway.rest.SqlGatewayRestEndpointFactory Review Comment: What's changed here? -- 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-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org