Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有个问题。我们可以在 cassandra mapreduce 程序中有几个 map 和 reduce 函数吗?例如 map1 读取数据并 reduce1 通过键对它们进行分组。map2 计算平均值,map3 Math.pow 计算结果,最后 reduce 函数写入输出?或类似的东西..?
是的,“连锁工作”是常见的做法。您基本上所做的就是将第一个 mapreduce 作业写入 HDFS,然后第二个 mapreduce 作业读取第一个作业的输出作为其输入。
本教程是一个有用的开始。
不回答你的问题,但是......
计算reducer 1中的平均值。计算平均值后,你也可以Math.pow在reducer 1中做吗?都是java代码,所以把计算写在reduce函数中。
Math.pow
另请注意,您不需要减速器来输出。Mappers 也可以输出数据,只需将 reducer 的数量设置为 0。