Spark函数之dependencies 2015-08-21 21:04

说明

返回本RDD依赖的RDD。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
scala> var b = sc.parallelize(List(1,2,3,4,5,6,7,8,2,4,2,1,1,1,1,1))
b: org.apache.spark.rdd.RDD[Int] = ParallelCollectionRDD[16] at parallelize at <console>:21

scala> b.dependencies.length
res4: Int = 0

scala> b.map(a => a).dependencies.length
res5: Int = 1

scala> b.map(_ + 2).dependencies.length
res7: Int = 1

scala> b.cartesian(a).dependencies.length
res8: Int = 2

scala> b.cartesian(a).dependencies
res9: Seq[org.apache.spark.Dependency[_]] = List(org.apache.spark.rdd.CartesianRDD$$anon$1@105dacb5, 
org.apache.spark.rdd.CartesianRDD$$anon$2@75f5a777)

scala>
Tags: #Spark    Post on Spark-API