0
出力ファイルに書き込むために、HBaseの値が必要ない場合があります。 私はマップ出力キーの型としてNullWritable.classを使用しています。 私は出力値をカラム値に基づいて分割する必要があります。しかし、私たちはカスタムパーティションがキーに基づいて動作することを知っています。まさに私は、パーティションの値が1であり、これは私のリターンint型のパーティション40と比較してきているし、それが例外をスローする方法をここでMapTask.classMapleduce HadoopのNullWritableキータイプのカスタムパーティション
if (partition < 0 || partition >= partitions) {
throw new IOException("Illegal partition for " + key + " (" +
partition + ")");
}
で例外を取得しています場所です
Caused by: java.io.IOException: Illegal partition for (null) (40)
ここに私が使用しているドライバコードがあります。
TableMapReduceUtil.initTableMapperJob(args[0], // input table
scan, // Scan instance to control CF and attribute selection
DefaultMapper.class, // mapper class
NullWritable.class, // mapper output value
Text.class, // mapper output key
job);
これは私のパーティションのコード
public class FinancialLineItemPartioner extends Partitioner< NullWritable,Text> {
public int getPartition(NullWritable key, Text value, int setNumRedTask) {
String str = key.toString();
if (str.contains("Japan|^|BUS")) {
return 0;
} else if (str.contains("Japan|^|CAS")) {
return 1;
} else if (str.contains("Japan|^|CUS")) {
return 2;
}else {
return 3;
}
..です
注意を提案してください:私は、マップ出力のキー/値のパラメータを交換する場合は、私の減速が作動していません。
マッパーでヌルキーを持つことは意味がありません。どのようにあなたの値を減算器でグループ化したいですか? – AdamSkywalker