terana commented on code in PR #54445:
URL: https://github.com/apache/spark/pull/54445#discussion_r2852012153


##########
sql/connect/server/src/main/scala/org/apache/spark/sql/connect/service/ExecuteEventsManager.scala:
##########
@@ -78,12 +126,36 @@ case class ExecuteEventsManager(executeHolder: 
ExecuteHolder, clock: Clock) {
 
   private var producedRowCount = Option.empty[Long]
 
+  private var _terminationReason: Option[TerminationReason] = None
+
   /**
    * @return
    *   Last event posted by the Connect request
    */
   private[connect] def status: ExecuteStatus = _status
 
+  /**
+   * @return
+   *   The reason for termination, set when the operation finishes, fails, or 
is canceled. Since
+   *   the closed state itself does not convey why the operation ended, this 
value preserves that
+   *   information for later use.
+   */
+  private[connect] def terminationReason: Option[TerminationReason] = 
_terminationReason

Review Comment:
   It can be read and written by execution thread or maintenance/interrupt 
thread (only one of those, the latter checks for execution thread status before 
doing cleanup itself), and can be read (through getExecuteInfo, 
getTerminationInfo) by various threads simultaneously. Same for _status above
   
   Will add volatile for both



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