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


##########
externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/operation/ExecuteStatement.scala:
##########
@@ -120,12 +120,31 @@ class ExecuteStatement(
     super.validateFetchOrientation(order)
   }
 
+  override def cancel(): Unit = withLockRequired {
+    if (!isTerminalState(state)) {
+      setState(OperationState.CANCELED)
+      // TODO: If `shouldRunAsync` is true, the statement is initialized 
lazily.
+      // When a SQL is submitted and immediately canceled, `jdbcStatement` may 
still be null,
+      // which can lead to the cancellation not taking effect.
+      if (jdbcStatement != null) {
+        dialect.cancelStatement(jdbcStatement)
+        jdbcStatement = null
+      } else {
+        warn(s"The cancel operation $statementId might be ignore due to 
jdbcStatement is null.")

Review Comment:
   done



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