asl3 commented on code in PR #53625:
URL: https://github.com/apache/spark/pull/53625#discussion_r2653265043


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/SQLExecution.scala:
##########
@@ -92,8 +93,17 @@ object SQLExecution extends Logging {
     val sparkSession = queryExecution.sparkSession
     val sc = sparkSession.sparkContext
     val oldExecutionId = sc.getLocalProperty(EXECUTION_ID_KEY)
+    val oldQueryId = sc.getLocalProperty(QUERY_ID_KEY)
     val executionId = SQLExecution.nextExecutionId
+    // Use the original queryId for the first execution, generate new ones for
+    // subsequent executions
+    val queryId = if (queryExecution.firstExecution.compareAndSet(true, 
false)) {
+      queryExecution.queryId
+    } else {
+      UUIDv7Generator.generate()
+    }

Review Comment:
   This `queryId` inside `withNewExecutionId0` is just sent to 
`SparkListenerSQLExecutionStart` and end, so it is just the "execution id". 
QueryExecution still stores its original `queryId`. 
   
   Agree we could rename the val in `withNewExecutionId0` though. 



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