0
是否可以将减速器输出发送到基于密钥的多个文件?像,根据键/值对(HADOOP)将输出减少到所需文件
if(key1)
{
//output to file1 using context.write() or otherwise
}
else
{
//output to file2 using context.write() or otherwise
}
是否可以将减速器输出发送到基于密钥的多个文件?像,根据键/值对(HADOOP)将输出减少到所需文件
if(key1)
{
//output to file1 using context.write() or otherwise
}
else
{
//output to file2 using context.write() or otherwise
}
你应该能够在你的减速机一起使用条件逻辑与MultipleOutputs
类来实现你在找什么做的。他们有一个如何在javadoc链接中执行此操作的示例。
另一种可能的方法是实施自定义Partitioner。通过这种方式,可以根据密钥的值来运行两个(多个)reducer并进行相应的分区。