Worker RDD i really like scala i want to learn to code in scala as soon as I can Map[String, Int]() Map[String, Int]() Map[String, Int]() Map[String, Int]() Map[String, Int]()
A can form a Semigroup it has an associative binary operation. trait Semigroup[A] { def combine(x: A, y: A): A } Associativity means the following equality must hold for any choice of x, y, and z. combine(x, combine(y, z)) = combine(combine(x, y), z) https://typelevel.org/cats/typeclasses/semigroup.html
.map(x => (x, 1)) .reduceByKey((a, b) => a + b) word count hello 1 * = word count hello A world C word count hello B scala D word count hello A+B world C scala D
class WordCount … { !// represents a set of (word, count) } def combine(a: WordCount, b: WordCount): WordCount = !// combines to WordCount into one def combineMany(xs: List[WordCount]): WordCount = ???