私のコードでは、データを3つの部分に分割していますが、出力では、リデューサーの数を3に設定しても、0番目のパーティションによって返される出力のみが得られます
私のコード
public static class customPartitioner extends Partitioner<Text,Text>{
public int getPartition(Text key, Text value, int numReduceTasks){
String country = value.toString();
if(numReduceTasks==0)
return 0;
if(key.equals(new Text("key1")) && !value.equals(new Text("valuemy")))
return 1%numReduceTasks;
if(value.equals(new Text("valueother")) && key.equals(new Text("key1")) )
return 0;
else
return 2%numReduceTasks;
}
}
レデューサーの数を次のように設定します
job.setNumReduceTasks(3);
0番目のパーティションのみの出力、つまり0を返す