Skip to content

Commit 1d8d125

Browse files
committed
Fix SPARK-8062 with additional null checks
1 parent b6430f0 commit 1d8d125

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

core/src/main/scala/org/apache/spark/deploy/SparkHadoopUtil.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,13 @@ class SparkHadoopUtil extends Logging {
175175
private def getFileSystemThreadStatistics(path: Path, conf: Configuration): Seq[AnyRef] = {
176176
val qualifiedPath = path.getFileSystem(conf).makeQualified(path)
177177
val scheme = qualifiedPath.toUri().getScheme()
178-
val stats = FileSystem.getAllStatistics().filter(_.getScheme().equals(scheme))
179-
stats.map(Utils.invoke(classOf[Statistics], _, "getThreadStatistics"))
178+
if (scheme == null) {
179+
Seq.empty
180+
} else {
181+
FileSystem.getAllStatistics
182+
.filter { stats => scheme.equals(stats.getScheme) }
183+
.map(Utils.invoke(classOf[Statistics], _, "getThreadStatistics"))
184+
}
180185
}
181186

182187
private def getFileSystemThreadStatisticsMethod(methodName: String): Method = {

0 commit comments

Comments
 (0)