![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
spark
jsaon_pg
热爱编程,喜欢学习新技术。
展开
-
spark累加器Accumulator
1 使用累加器的背景 spark在调度任务时,master会挑选一个worker成为driver。 在使用spark的action算子时,会触发job任务,开始计算。 此时,开始切分,driver分发Task给相应的executor,每个executor是相对独立的。 对应在action算子范围内的变量会各自独立。如果在action算子代码内使用driver算子代码范围的变量, 会形成在每个exe...原创 2019-09-17 15:18:32 · 199 阅读 · 0 评论 -
spark编写wordcount程序
object WordCount { def main(args: Array[String]): Unit = { val lines = Array("hello tom hello jerry", "hello kitty hello tom", "hello tom tom") //按空格切割行成词,形成RDD(Array(),Array(),...),在flat...原创 2019-09-17 15:32:22 · 323 阅读 · 0 评论