Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 基于键/值对(HADOOP)将输出减少到所需文件_Java_Hadoop_Mapreduce_Key Value_Reduce - Fatal编程技术网

Java 基于键/值对(HADOOP)将输出减少到所需文件

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链接中有一个例子说明了如何做到这一点。另一种可能的方

是否可以基于密钥将reducer输出发送到多个文件?像

if(key1)
 {
        //output to file1 using context.write() or otherwise
  }
 else
 {
        //output to file2 using context.write() or otherwise
 }

您应该能够在reducer中与类一起使用条件逻辑来实现您想要做的事情。他们在javadoc链接中有一个例子说明了如何做到这一点。

另一种可能的方法是实现定制。这样就可以运行两个(多个)约简器,并根据键的值进行相应的分区