[SPARK-20886][CORE] HadoopMapReduceCommitProtocol to handle FileOutputCommitter.getWorkPath==null
## What changes were proposed in this pull request? Handles the situation where a `FileOutputCommitter.getWorkPath()` returns `null` by downgrading to the supplied `path` argument. The existing code does an `Option(workPath.toString).getOrElse(path)`, which triggers an NPE in the `toString()` operation if the workPath == null. The code apparently was meant to handle this (hence the getOrElse() clause, but as the NPE has already occurred at that point the else-clause never gets invoked. ## How was this patch tested? Manually, with some later code review. Author: Steve Loughran <stevel@hortonworks.com> Closes #18111 from steveloughran/cloud/SPARK-20886-committer-NPE.
This commit is contained in:
parent
3d0e174244
commit
e47f48c737
|
@ -73,7 +73,8 @@ class HadoopMapReduceCommitProtocol(jobId: String, path: String)
|
|||
|
||||
val stagingDir: String = committer match {
|
||||
// For FileOutputCommitter it has its own staging path called "work path".
|
||||
case f: FileOutputCommitter => Option(f.getWorkPath.toString).getOrElse(path)
|
||||
case f: FileOutputCommitter =>
|
||||
Option(f.getWorkPath).map(_.toString).getOrElse(path)
|
||||
case _ => path
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue