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


##########
externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/operation/PlanOnlyStatement.scala:
##########
@@ -76,27 +79,48 @@ class PlanOnlyStatement(
 
   override protected def runInternal(): Unit =
     try {
-      withLocalProperties {
-        SQLConf.withExistingConf(spark.sessionState.conf) {
-          val parsed = spark.sessionState.sqlParser.parsePlan(statement)
-          parsed match {
-            case cmd if planExcludes.contains(cmd.getClass.getSimpleName) =>
-              result = spark.sql(statement)
-              iter = new ArrayFetchIterator(result.collect())
-
-            case plan => style match {
-                case PlainStyle => explainWithPlainStyle(plan)
-                case JsonStyle => explainWithJsonStyle(plan)
-                case UnknownStyle => unknownStyleError(style)
-                case other => throw notSupportedStyleError(other, "Spark SQL")
-              }
-          }
+      if (queryTimeout > 0) {
+        val timeoutExecutor =
+          
ThreadUtils.newDaemonSingleThreadScheduledExecutor("query-timeout-thread", 
false)

Review Comment:
   Tes, this is expensive. I will add a new method 
   ```java
   def runWithTimeoutFallback(task: Runnable,
                                onTimeout: Runnable,
                                timeoutSeconds: Long): Unit = {
       val future = timeoutScheduler.submit(task)
       try {
         future.get(timeoutSeconds, TimeUnit.SECONDS)
       } catch {
         case _: TimeoutException =>
           future.cancel(true)
           onTimeout.run()
       }
     }
   ```
   at `OperationManager` to deal with this.
   
   And I had also assumed that plan-only statements could respond to timeouts, 
but I discovered that they cannot.



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