【发布时间】:2015-01-03 00:16:23
【问题描述】:
假设,我在 Spark 中有一个键值对,如下所示。
[ (Key1, Value1), (Key1, Value2), (Key1, Vaue3), (Key2, Value4), (Key2, Value5) ]
现在我想把它减少到这样的程度。
[ (Key1, [Value1, Value2, Value3]), (Key2, [Value4, Value5]) ]
即从Key-Value到Key-List of Values。
如何在 python 或 scala 中使用 map 和 reduce 函数?
【问题讨论】:
-
因此,您需要 Scala 或 Python 或普通 Scala 中的 Spark 解决方案 | Python解决方案?换句话说,您的起始收藏是 RDD 吗?
-
真是一团糟。为什么它同时被标记为
scala和python...
标签: python list scala bigdata apache-spark