将groupByKey转换为reduceBykey

时间:2018-01-23 15:34:56

标签: scala apache-spark

我想将以下healthText.text = "Health: " + currentTarget.health;转换为groupByKey

reduceByKey

如何通过像block.groupByKey(_.key) .reduceGroups((left, right) => left.copy( contributingReferences = left.contributingReferences ++ right.contributingReferences, linkTypes = left.linkTypes ++ right.linkTypes, contexts = left.contexts ++ right.contexts ) ) .map(group => group._2.copy( contributingReferences = ArrayUtil.dedup(group._2.contributingReferences, _.key) ) ) 那样的scala糖语法来实现这一目标?

这是我找到的一个例子

(_+_)

0 个答案:

没有答案