特牛网址导航

spark自定义累加器 map_spark累加器存一份map数据-CSDN博客

网友收藏
文章浏览阅读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数据