gpt4 book ai didi

java - Hadoop循环 reducer

转载 作者:行者123 更新时间:2023-12-02 21:58:09 25 4
gpt4 key购买 nike

我试图找到一种方法来“循环”我的 reducer ,例如:

for(String document: tempFrequencies.keySet())
{
if(list.get(0).equals(document))
{
testMap.put(key.toString(), DF.format(tfIDF));
}
}
//This allows me to create a hashmap which i plan to write out to context as Filename = key then all of the terms weights = value (a list I can parse out in the next job)

当前的代码将贯穿整个reduce,并为我提供list.get(0)所需的内容,但是问题是一旦完成整个reduce,我需要重新为list.get(1)等启动。关于减少阶段完成后如何循环的想法?

最佳答案

嵌套for循环

for(int i = 0; i < number_of_time; i++){
//your code

}

用i替换0。

关于java - Hadoop循环 reducer ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7288636/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com