Github user LantaoJin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20803#discussion_r174105959
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/SQLExecution.scala ---
    @@ -34,6 +34,16 @@ object SQLExecution {
     
       private val executionIdToQueryExecution = new ConcurrentHashMap[Long, 
QueryExecution]()
     
    +  private val executionIdToSqlText = new ConcurrentHashMap[Long, String]()
    +
    +  def setSqlText(sqlText: String): Unit = {
    +    executionIdToSqlText.putIfAbsent(_nextExecutionId.get(), sqlText)
    --- End diff --
    
    `setSqlText` is invoked before `withNewExecutionId`. First time 
`_nextExecutionId` is 0 by default, so `setSqlText` store (0, x) in map. When 
`withNewExecutionId` is invoked, the code `val executionId = 
SQLExecution.nextExecutionId` increase the execution id and return the previous 
execution id, 0. Then `val sqlText = getSqlText(executionId)` will return the 
sql text which 0 mapped, x. Next time when `setSqlText` is  invoked, 
_nextExecutionId.get() return the next value, 1. So the new sql text store with 
in map like (1, y).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to