在Debug spark源码的时候,追踪到了count()函数的实现。学习到了一个scala的语法。代码如下
/**
* Return the number of elements in the RDD.
*/
def count(): Long = sc.runJob(this, Utils.getIteratorSize _).sum
runJob()的第二个参数后面的下划线代表把方法转换为函数。
在Debug spark源码的时候,追踪到了count()函数的实现。学习到了一个scala的语法。代码如下
/**
* Return the number of elements in the RDD.
*/
def count(): Long = sc.runJob(this, Utils.getIteratorSize _).sum
runJob()的第二个参数后面的下划线代表把方法转换为函数。