WencongLiu commented on code in PR #20609: URL: https://github.com/apache/flink/pull/20609#discussion_r953373052
########## 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: This has been modified to keep fetching data until no data is generated. ########## 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: This has been modified to keep fetching data until no data is generated. -- 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