monkeyboy123 commented on code in PR #39102:
URL: https://github.com/apache/spark/pull/39102#discussion_r1052167027
##########
sql/core/src/main/scala/org/apache/spark/sql/internal/SharedState.scala:
##########
@@ -109,13 +109,18 @@ private[sql] class SharedState(
* A status store to query SQL status/metrics of this Spark application,
based on SQL-specific
* [[org.apache.spark.scheduler.SparkListenerEvent]]s.
*/
- val statusStore: SQLAppStatusStore = {
- val kvStore =
sparkContext.statusStore.store.asInstanceOf[ElementTrackingStore]
- val listener = new SQLAppStatusListener(conf, kvStore, live = true)
- sparkContext.listenerBus.addToStatusQueue(listener)
- val statusStore = new SQLAppStatusStore(kvStore, Some(listener))
- sparkContext.ui.foreach(new SQLTab(statusStore, _))
- statusStore
+ val statusStore: SQLAppStatusStore = SharedState.synchronized {
Review Comment:
code like this:
```
val spark = SparkSession.builder()
.config(sparkConf)
.getOrCreate()
setDefaultSession(null)
setActiveSession(null)
val spark2 = SparkSession.builder()
.config(sparkConf)
.getOrCreate()
```
in `getOrCreate` function,`new SparkSession(sparkContext, None, None,
extensions, options.toMap)` new SparkSession object will be created,so
sharedState will be created multiple times.
--
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]