jasonli-db commented on code in PR #42244:
URL: https://github.com/apache/spark/pull/42244#discussion_r1280097399


##########
connector/connect/server/src/main/scala/org/apache/spark/sql/connect/ui/SparkConnectServerListener.scala:
##########
@@ -128,6 +126,43 @@ private[connect] class SparkConnectServerListener(
     }
   }
 
+  def onSQLExecutionStart(e: SparkListenerSQLExecutionStart): Unit = {
+    val executeJobTagOpt = e.jobTags.find {
+      case ExecuteJobTag(_) => true
+      case _ => false
+    }
+    if (executeJobTagOpt.isEmpty) {
+      return
+    }
+    val executeJobTag = executeJobTagOpt.get
+    val exec = executionList.get(executeJobTag)
+    if (exec.nonEmpty) {
+      exec.foreach { exec =>
+        exec.sqlExecId += e.executionId.toString
+        updateLiveStore(exec)
+      }
+    } else {
+      // This block guards against potential event re-ordering.

Review Comment:
   It's to guard against SQLStart and JobStart events potentially coming after 
an OperationClosed event. It's mirrors the one in onJobStart (which was 
included in the Thrift Server listener as well). See the comment here: 
https://github.com/apache/spark/pull/42244/files#diff-ffa4c6fbd382a52c08a0f10b7fbbd6c2d09de322f7e3145ecba464f0cda5843dR89-R92



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