1.美图
在Spark源代码里,每个算子总是有withScope ,而从源代码里,我们看到withScope的实现是RDDOperationScope.withScope[U](sc)(body)
/**
* Execute a block of code in a scope such that all new RDDs created in this body will
* be part of the same scope. For more detail, see {
{org.apache.spark.rdd.RDDOperationScope}}.
*
* 在一个范围,在这个范围中创建的所有新的RDDS将相同的范围执行一部分代码块。更多的细节,
* 看{
{org.apache.spark.rdd.RDDOperationScope}}.
*
* Note: Return statements are NOT allowed in the given body.
* 注意:在给定的正文中不允许返回语句。
*/
private[spark] def withScope[U](body: => U): U = RDDOperationScope.withScope[U](sc)(body)
// Transformations (return a new RDD) 转换(返回一个新的RDD)
/**
* Return a new RDD by applying a function to all elements of this RDD.
* 将一个函