linhongliu-db commented on code in PR #39268:
URL: https://github.com/apache/spark/pull/39268#discussion_r1065369984
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/SQLExecution.scala:
##########
@@ -55,6 +56,28 @@ object SQLExecution {
}
}
+ /**
+ * Track the "root" SQL Execution Id for nested/sub queries.
+ * For the root execution, rootExecutionId == executionId.
+ */
+ private def setRootExecutionId(sc: SparkContext, executionId: String): Unit
= {
+ // The current execution is the root execution if the root execution ID is
null
+ if (sc.getLocalProperty(EXECUTION_ROOT_ID_KEY) == null) {
+ sc.setLocalProperty(EXECUTION_ROOT_ID_KEY, executionId)
+ }
+ }
+
+ /**
+ * Unset the "root" SQL Execution Id once the "root" SQL execution completes.
+ */
+ private def unsetRootExecutionId(sc: SparkContext, executionId: String):
Unit = {
Review Comment:
after a second thought, this function wrapper is misleading and doesn't make
things clear. So I inlined it to the main function. Thanks for the suggestion.
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/ui/SQLListener.scala:
##########
@@ -43,6 +43,8 @@ case class SparkListenerSQLAdaptiveSQLMetricUpdates(
@DeveloperApi
case class SparkListenerSQLExecutionStart(
executionId: Long,
+ // if the execution is a root, then rootExecutionId == executionId
+ rootExecutionId: Long,
Review Comment:
done
--
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]