Java 基于键/值对(HADOOP)将输出减少到所需文件
是否可以基于密钥将reducer输出发送到多个文件?像Java 基于键/值对(HADOOP)将输出减少到所需文件,java,hadoop,mapreduce,key-value,reduce,Java,Hadoop,Mapreduce,Key Value,Reduce,是否可以基于密钥将reducer输出发送到多个文件?像 if(key1) { //output to file1 using context.write() or otherwise } else { //output to file2 using context.write() or otherwise } 您应该能够在reducer中与类一起使用条件逻辑来实现您想要做的事情。他们在javadoc链接中有一个例子说明了如何做到这一点。另一种可能的方
if(key1)
{
//output to file1 using context.write() or otherwise
}
else
{
//output to file2 using context.write() or otherwise
}
您应该能够在reducer中与类一起使用条件逻辑来实现您想要做的事情。他们在javadoc链接中有一个例子说明了如何做到这一点。另一种可能的方法是实现定制。这样就可以运行两个(多个)约简器,并根据键的值进行相应的分区