Skip to content

Commit e1f84be

Browse files
committed
Fix disk block manager test
1 parent 5a40a1c commit e1f84be

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

core/src/main/scala/org/apache/spark/storage/DiskBlockManager.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ private[spark] class DiskBlockManager(shuffleManager: ShuffleBlockManager, rootD
6060
* Otherwise, we assume the Block is mapped to the whole file identified by the BlockId.
6161
*/
6262
def getBlockLocation(blockId: BlockId): FileSegment = {
63-
if (blockId.isShuffle && SparkEnv.get.shuffleManager.isInstanceOf[SortShuffleManager]) {
63+
val env = SparkEnv.get
64+
if (blockId.isShuffle && env != null && env.shuffleManager.isInstanceOf[SortShuffleManager]) {
6465
val sortShuffleManager = SparkEnv.get.shuffleManager.asInstanceOf[SortShuffleManager]
6566
sortShuffleManager.getBlockLocation(blockId.asInstanceOf[ShuffleBlockId], this)
6667
} else if (blockId.isShuffle && shuffleManager.consolidateShuffleFiles) {

0 commit comments

Comments
 (0)