Skip to content

Commit

Permalink
[SPARK-23040][CORE][FOLLOW-UP] Avoid double wrap result Iterator.
Browse files Browse the repository at this point in the history
## What changes were proposed in this pull request?

Address apache#20449 (comment), If `resultIter` is already a `InterruptibleIterator`, don't double wrap it.

## How was this patch tested?
Existing tests.

Author: Xingbo Jiang <[email protected]>

Closes apache#20920 from jiangxb1987/SPARK-23040.
  • Loading branch information
jiangxb1987 committed Mar 31, 2018
1 parent cefb33f commit e9a661f
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,13 @@ private[spark] class BlockStoreShuffleReader[K, C](
case None =>
aggregatedIter
}
// Use another interruptible iterator here to support task cancellation as aggregator or(and)
// sorter may have consumed previous interruptible iterator.
new InterruptibleIterator[Product2[K, C]](context, resultIter)

resultIter match {
case _: InterruptibleIterator[Product2[K, C]] => resultIter
case _ =>
// Use another interruptible iterator here to support task cancellation as aggregator
// or(and) sorter may have consumed previous interruptible iterator.
new InterruptibleIterator[Product2[K, C]](context, resultIter)
}
}
}

0 comments on commit e9a661f

Please sign in to comment.