Copilot commented on code in PR #7720:
URL: https://github.com/apache/ignite-3/pull/7720#discussion_r2894321443


##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/ExecutionServiceImplTest.java:
##########
@@ -321,11 +321,21 @@ public void tearDown() throws Exception {
 
         mailboxes.clear();
 
-        executionServices.forEach(executer -> {
+        executionServices.forEach(executionService -> {
             try {
+                executionService.stop();
+            } catch (Exception e) {
+                log.error("Unable to stop execution service", e);
+            }
+        });
+
+        executers.forEach(executer -> {
+            try {
+                Awaitility.await().until(() -> ((QueryTaskExecutorImpl) 
executer).queueSize(), is(0));

Review Comment:
   The unchecked cast `((QueryTaskExecutorImpl) executer)` in teardown will 
throw a `ClassCastException` if the `executers` list contains 
non-`QueryTaskExecutorImpl` instances. This is the case for the 
`timeoutFiredOnInitialization` test which uses `TestSingleThreadQueryExecutor` 
instead. Although that test is currently `@Disabled`, re-enabling it would 
cause the teardown to fail with a `ClassCastException`. 
   
   Consider checking with `instanceof` before casting, or using an interface 
method on `QueryTaskExecutor` to expose the queue size (perhaps only checking 
if the executer is a `QueryTaskExecutorImpl`), or using a conditional approach 
like:
   - Only performing the queue drain wait if the executer is an instance of 
`QueryTaskExecutorImpl`
   - Using the existing `executor.queue::isEmpty` pattern already used in 
`timeoutFiredOnInitialization` (line 958)
   ```suggestion
                   if (executer instanceof QueryTaskExecutorImpl) {
                       Awaitility.await().until(() -> ((QueryTaskExecutorImpl) 
executer).queueSize(), is(0));
                   }
   ```



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