ulysses-you commented on a change in pull request #30481:
URL: https://github.com/apache/spark/pull/30481#discussion_r537242559



##########
File path: 
sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/ThriftServerWithSparkContextSuite.scala
##########
@@ -79,6 +84,45 @@ trait ThriftServerWithSparkContextSuite extends 
SharedThriftServer {
         "java.lang.NumberFormatException: invalid input syntax for type 
numeric: 1.2"))
     }
   }
+
+  test("SPARK-33526: Add config to control if cancel invoke interrupt task on 
thriftserver") {
+    withJdbcStatement { statement =>
+      val forceCancel = new AtomicBoolean(false)
+      val listener = new SparkListener {
+        override def onTaskEnd(taskEnd: SparkListenerTaskEnd): Unit = {
+          taskEnd.reason match {
+            case _: TaskKilled =>
+              if (forceCancel.get()) {
+                assert(System.currentTimeMillis() - 
taskEnd.taskInfo.launchTime < 1000)
+              } else {
+                assert(System.currentTimeMillis() - 
taskEnd.taskInfo.launchTime >= 2900)

Review comment:
       Without this PR, the comparison `running time of forceCancel=false` also 
can langer than `running time of forceCancel=true` due to accuracy.  How about 
check 2s ? I believe it is stable enough.




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

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