pan3793 commented on code in PR #7249:
URL: https://github.com/apache/kyuubi/pull/7249#discussion_r2544328416


##########
externals/kyuubi-jdbc-engine/src/test/scala/org/apache/kyuubi/engine/jdbc/mysql/OperationWithEngineSuite.scala:
##########
@@ -75,4 +78,26 @@ class OperationWithEngineSuite extends MySQLOperationSuite 
with HiveJDBCTestHelp
       assert(tFetchResultsResp.getStatus.getStatusCode === 
TStatusCode.SUCCESS_STATUS)
     }
   }
+
+  test("MySQL - JDBC ExecuteStatement cancel operation should kill SQL 
statement") {
+    failAfter(20.seconds) {
+      withSessionHandle { (client, handle) =>
+        val tExecuteStatementReq = new TExecuteStatementReq()
+        tExecuteStatementReq.setSessionHandle(handle)
+        // The SQL will sleep 120s
+        tExecuteStatementReq.setStatement("SELECT sleep(120)")
+        tExecuteStatementReq.setRunAsync(true)
+        val tExecuteStatementResp = 
client.ExecuteStatement(tExecuteStatementReq)
+        assert(tExecuteStatementResp.getStatus.getStatusCode === 
TStatusCode.SUCCESS_STATUS)
+
+        Thread.sleep(1000) // wait for statement to start executing

Review Comment:
   I can't recall the detail, but do we have a reliable way to check that the 
stmt is running?
   
   if so, we can write it like this
   ```
   eventually(timeout(5.seconds), interval(100.millis)) {
     // a reliable way to check op is executing
     ...
   }
   ```



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