yuanhang-dev commented on code in PR #10125:
URL: 
https://github.com/apache/incubator-gluten/pull/10125#discussion_r2218083715


##########
gluten-flink/ut/src/test/java/org/apache/gluten/table/runtime/stream/custom/NexmarkTest.java:
##########
@@ -127,6 +130,26 @@ private void executeQuery(StreamTableEnvironment tEnv, 
String queryFileName) {
     if (!insertQuery.isEmpty()) {
       TableResult insertResult = tEnv.executeSql(insertQuery);
       assertThat(insertResult.getJobClient().isPresent()).isTrue();
+      try {
+        waitForJobCompletion(insertResult, 30000);
+      } catch (Exception e) {
+        throw new RuntimeException("Query execution failed: " + queryFileName, 
e);
+      }
+    }
+  }
+
+  private void waitForJobCompletion(TableResult result, long timeoutMs) {
+    if (result.getJobClient().isPresent()) {
+      var jobClint = result.getJobClient().get();
+      try {
+        jobClint.getJobExecutionResult().get(timeoutMs, TimeUnit.MILLISECONDS);
+      } catch (ExecutionException e) {
+        throw new RuntimeException("Job timeout after ", e);
+      } catch (TimeoutException e) {
+        throw new RuntimeException("Job execution failed ", e);

Review Comment:
   I'll fix this comment in 
https://github.com/apache/incubator-gluten/pull/10092



##########
gluten-flink/ut/src/test/java/org/apache/gluten/table/runtime/stream/custom/NexmarkTest.java:
##########
@@ -127,6 +130,26 @@ private void executeQuery(StreamTableEnvironment tEnv, 
String queryFileName) {
     if (!insertQuery.isEmpty()) {
       TableResult insertResult = tEnv.executeSql(insertQuery);
       assertThat(insertResult.getJobClient().isPresent()).isTrue();
+      try {
+        waitForJobCompletion(insertResult, 30000);
+      } catch (Exception e) {
+        throw new RuntimeException("Query execution failed: " + queryFileName, 
e);
+      }
+    }
+  }
+
+  private void waitForJobCompletion(TableResult result, long timeoutMs) {
+    if (result.getJobClient().isPresent()) {
+      var jobClint = result.getJobClient().get();
+      try {
+        jobClint.getJobExecutionResult().get(timeoutMs, TimeUnit.MILLISECONDS);
+      } catch (ExecutionException e) {
+        throw new RuntimeException("Job timeout after ", e);
+      } catch (TimeoutException e) {
+        throw new RuntimeException("Job execution failed ", e);
+      } catch (InterruptedException e) {
+        throw new RuntimeException(e);
+      }

Review Comment:
   Ditto.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to