mridulm commented on code in PR #54133:
URL: https://github.com/apache/spark/pull/54133#discussion_r2810502003


##########
sql/core/src/main/scala/org/apache/spark/sql/internal/SharedState.scala:
##########
@@ -120,11 +120,17 @@ private[sql] class SharedState(
    */
   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
+    // Only create SQLAppStatusListener when explicitly enabled to avoid 
memory overhead
+    if (conf.get(SQL_UI_APP_STATUS_LISTENER_ENABLED)) {
+      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
+    } else {
+      // When disabled, create a minimal status store without listener
+      new SQLAppStatusStore(kvStore, None)
+    }

Review Comment:
   If this is specific to UI, control it using `spark.ui.enabled` and avoid 
introducing a config ? Similar (as a pattern) to `streamingQueryStatusListener` 
below.
   



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