是否可以根据 key 将 reducer 输出发送到多个文件?就像,
if(key1)
{
//output to file1 using context.write() or otherwise
}
else
{
//output to file2 using context.write() or otherwise
}
最佳答案
您应该能够在您的 reducer 中使用条件逻辑以及 MultipleOutputs
类来实现您想要做的事情。他们在链接的 javadoc 中提供了如何执行此操作的示例。
关于java - 根据键/值对 (HADOOP) 将输出减少到所需文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16152232/