1. 程式人生 > >Transformation運算元,action運算元,產生shuffle的運算元

Transformation運算元,action運算元,產生shuffle的運算元

Transformation的官方文件方法集合如下:

map
filter
flatMap
mapPartitions
mapPartitionsWithIndex
sample
union
intersection
distinct
groupByKey
reduceByKey
aggregateByKey
sortByKey
join
cogroup
cartesian
pipe
coalesce
repartition
repartitionAndSortWithinPartitions

Action的官方文件方法集合如下:

reduce
collect
count
first
take
takeSample
takeOrdered
saveAsTextFile
saveAsSequenceFile
saveAsObjectFile
countByKey
foreach

Spark會產生shuffle的運算元

去重

distinct

聚合

reduceByKey
groupBy
groupByKey
aggregateByKey
combineByKey

排序

sortByKey
sortBy

重分割槽

coalesce
repartition

集合或者表操作

intersection
subtract
subtractByKey
join
leftOuterJoin