spark相关问题

1.transformation和action的区别

Transformation:代表的是转化操作就是我们的计算流程,返回是RDD[T],可以是一个链式的转化,并且是延迟触发的。
Action:代表是一个具体的行为,返回的值非RDD类型,可以一个object,或者是一个数值,也可以为Unit代表无返回值,并且action会立即触发job的执行。
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
 
 

cache和persist的区别

cache只有一个默认的缓存级别MEMORY_ONLY

cache调用了persist

persist可以根据情况设置其它的缓存级别

flatmap和map区别

map是把

 
查看kafka某个topic
kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list hbak1:9092 --topic zb
create by cphmvp email:cphmvp@163.com 爬虫技术交流_crawler QQ群 :167047843
原文地址:https://www.cnblogs.com/cphmvp/p/14692397.html