第223讲:Spark Shuffle Pluggable框架ShuffleReader解析
ShuffleReader:具体实现Stage在读取上一个Stage结果的接口。
在reduce任务中,读取mappers中的聚合数据。
从上一个shuffleMapTask中读取想要的数据,读取的内容是Iterator,具体的读可以看它的子类。
private[spark] trait ShuffleReader[K, C] {
/** Read the combined key-values for this reduce task */
def read(): Iterator[Product2[K, C]]
/**
* Close this reader.
* TODO: Add this back when we make the ShuffleReader a developer API that others can implement
* (at which point this will likely be necessary).
*/
// def stop(): Unit
}
具体实现的时候shuffleReader通过MapOutputTracker获取数据的位置信息。shuffleWriter将MapStatus相关信息交给Driver,Driver中有MapOutputTracker。
之前shuffleReader的子类是HashShuffleReader ,在Release 1.6.0版本中将HashShuffleReader 更名为BlockStoreShuffleReader
[SPARK-10704] Ren