hadoop - 如何在hadoop mapreduce -matrix乘法中格式化输出

标签 hadoop mapreduce reducers

Reducer -matrix乘法的输出格式为(key,value)

0,0,66
0,1,78
0,2,90
1,0,20
1,1,35
1,2,40

但我想要矩阵格式
66 78 90
20 35 40

请帮忙。

最佳答案

来自Hadoop: The Definitive Guide, 4th Edition

map: (K1, V1) → list(K2, V2)
reduce: (K2, list(V2)) → list(K3, V3)

In general, the map input key and value types (K1 and V1) are different from the map output types (K2 and V2). However, the reduce input must have the same types as the map output, although the reduce output types may be different again (K3 and V3).



所以我不确定您正在寻找的输出是否可以使用reduce。

您可以检查其他OutputFormats:

enter image description here

关于hadoop - 如何在hadoop mapreduce -matrix乘法中格式化输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58406031/

相关文章:

python - 如何在 Python 上逐行从 sys.stdin 获取前 N 行

hadoop - 在包含空间的路径中使用jar设置mapreduce.job.jar

Hadoop 并行运行 reducer

javascript - 如何让这段代码看起来更好

hadoop - 运行配置单元查询时收到以下错误。可能是什么原因造成的?

hadoop - Hadoop 2.2.0安装

java - Hadoop MapReduce中更好的采样方式

bash - 使用 SSH 和 NFS 在集群上进行并行化的最简单方法是什么?

javascript - Redux 操作未触发 reducer

javascript - 如何在 redux reducer 中改变状态数组?