Skip to content

Commit db24787

Browse files
committed
[SPARK-29046] Fix NPE in SQLConf.get when active SparkContext is stopping
1 parent 13b77e5 commit db24787

File tree

1 file changed

+2
-1
lines changed
  • sql/catalyst/src/main/scala/org/apache/spark/sql/internal

1 file changed

+2
-1
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ object SQLConf {
139139
}
140140
} else {
141141
val isSchedulerEventLoopThread = SparkContext.getActive
142-
.map(_.dagScheduler.eventProcessLoop.eventThread)
142+
.flatMap { sc => Option(sc.dagScheduler) }
143+
.map(_.eventProcessLoop.eventThread)
143144
.exists(_.getId == Thread.currentThread().getId)
144145
if (isSchedulerEventLoopThread) {
145146
// DAGScheduler event loop thread does not have an active SparkSession, the `confGetter`

0 commit comments

Comments
 (0)