dongjoon-hyun commented on code in PR #52575:
URL: https://github.com/apache/spark/pull/52575#discussion_r2427028614


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/QueryExecution.scala:
##########
@@ -272,8 +272,12 @@ class QueryExecution(
    */
   def toRdd: RDD[InternalRow] = lazyToRdd.get
 
+  private val observedMetricsLock = new Object
+
   /** Get the metrics observed during the execution of the query plan. */
-  def observedMetrics: Map[String, Row] = 
CollectMetricsExec.collect(executedPlan)
+  def observedMetrics: Map[String, Row] = observedMetricsLock.synchronized {

Review Comment:
   Thank you, @sarutak . Please add the following annotation, 
`javax.annotation.concurrent.GuardedBy`.
   
   ```scala
   @GuardedBy("observedMetricsLock")
   ```



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