【发布时间】:2015-08-24 15:14:34
【问题描述】:
我正在学习 Spark 源代码,对以下代码感到困惑:
/**
* Return a new RDD containing the distinct elements in this RDD.
*/
def distinct(numPartitions: Int)(implicit ord: Ordering[T] = null): RDD[T] =
map(x => (x, null)).reduceByKey((x, y) => x, numPartitions).map(_._1)
map(x => (x, null)) 函数的输入数据是什么?为什么以及何时可以省略输入?
更新:
这里是源代码的link。
【问题讨论】:
-
链接到源代码?
-
嗨@Daenyth 感谢您的提醒,我已经添加了源代码的链接。
标签: scala apache-spark scala-collections scala-2.10