Advertisement

Spark RDD 阶段划分与源代码分析

阅读量:

Spark版本2.4.5,从RDD.scala的collect函数为入口分析阶段划分流程

复制代码
 // --------------- 1 -----------------

    
 def collect(): Array[T] = withScope {
    
   // 跳进这个runJob
    
   val results = sc.runJob(this, (iter: Iterator[T]) => iter.toArray)
    
   Array.concat(results: _*)
    
 }
    
  
    
  
    
 // --------------- 2 -----------------
    
 def runJob[T, U: ClassTag](rdd: RDD[T], func: Iterator[T] => U): Array[U] = {
    
   // 继续往里跳, 跳到最后一个runJob
    
   runJob(rdd, func, 0 until rdd.partitions.length)
    
 }
    
  
    
 // --------------- 3 -----------------
    
 def runJob[T, U:

全部评论 (0)

还没有任何评论哟~