- 链接地址:https://yangyong.blog.csdn.net/article/details/121134463
- 链接标题:spark自定义累加器 map_spark累加器存一份map数据-CSDN博客
- 所属网站:yangyong.blog.csdn.net
- 被收藏次数:3964
文章浏览阅读374次。定义import org.apache.spark.util.AccumulatorV2import scala.collection.mutable// T: (String, Int) 这里使用案例是统计词频 (单词,出现次数)class WordCountAccumulator[T] private extends AccumulatorV2[T, mutable.Map[String, Int]] { val _map = mutable.Map[String, Int]().._spark累加器存一份map数据
版权声明:本文发布于特牛网址导航 内容均来源于互联网 如有侵权联系删除