Skip to content

Commit

Permalink
[CORE] Minor: Fix warnings and rename event handler better (apache#7412)
Browse files Browse the repository at this point in the history
  • Loading branch information
surnaik authored Oct 8, 2024
1 parent 8cb3e70 commit 02ac614
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ object GlutenBuildInfo {
throw new GlutenException(s"Can not load the core build file: $buildFile")
}

val unknown = "<unknown>"
private val unknown = "<unknown>"
private val props = new Properties()

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@ import org.apache.gluten.events.{GlutenBuildInfoEvent, GlutenPlanFallbackEvent}

import org.apache.spark.{SparkConf, SparkContext}
import org.apache.spark.internal.Logging
import org.apache.spark.scheduler._
import org.apache.spark.sql.internal.StaticSQLConf._
import org.apache.spark.scheduler.{SparkListener, SparkListenerEvent}
import org.apache.spark.sql.internal.StaticSQLConf.UI_RETAINED_EXECUTIONS
import org.apache.spark.status.{ElementTrackingStore, KVUtils}

import scala.collection.mutable

class GlutenSQLAppStatusListener(conf: SparkConf, kvstore: ElementTrackingStore)
private class GlutenSQLAppStatusListener(conf: SparkConf, kvstore: ElementTrackingStore)
extends SparkListener
with Logging {

private val executionIdToDescription = new mutable.HashMap[Long, String]
private val executionIdToFallbackEvent = new mutable.HashMap[Long, GlutenPlanFallbackEvent]

Expand Down Expand Up @@ -78,14 +77,14 @@ class GlutenSQLAppStatusListener(conf: SparkConf, kvstore: ElementTrackingStore)
executionIdToDescription.put(event.executionId, event.description)
}

private def onSQLExtensionEnd(event: SparkListenerSQLExecutionEnd): Unit = {
private def onSQLExecutionEnd(event: SparkListenerSQLExecutionEnd): Unit = {
executionIdToDescription.remove(event.executionId)
executionIdToFallbackEvent.remove(event.executionId)
}

override def onOtherEvent(event: SparkListenerEvent): Unit = event match {
case e: SparkListenerSQLExecutionStart => onSQLExecutionStart(e)
case e: SparkListenerSQLExecutionEnd => onSQLExtensionEnd(e)
case e: SparkListenerSQLExecutionEnd => onSQLExecutionEnd(e)
case e: GlutenBuildInfoEvent => onGlutenBuildInfo(e)
case e: GlutenPlanFallbackEvent => onGlutenPlanFallback(e)
case _ => // Ignore
Expand All @@ -99,7 +98,7 @@ class GlutenSQLAppStatusListener(conf: SparkConf, kvstore: ElementTrackingStore)

val view = kvstore.view(classOf[GlutenSQLExecutionUIData]).first(0L)
val toDelete = KVUtils.viewToSeq(view, countToDelete.toInt)(_ => true)
toDelete.foreach(e => kvstore.delete(e.getClass(), e.executionId))
toDelete.foreach(e => kvstore.delete(e.getClass, e.executionId))
}
}

Expand Down

0 comments on commit 02ac614

Please sign in to comment.