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