MapReduce ストリーミング ジョブにカスタム (Java) パーティショナーを接続しようとしています。私はこのコマンドを使用しています:
../bin/hadoop jar ../contrib/streaming/hadoop-streaming-1.2.1.jar \
-libjars ./NumericPartitioner.jar -D mapred.map.tasks=12 -D mapred.reduce.tasks=36 \
-input /input -output /output/keys -mapper "map_threeJoin.py" -reducer "keycount.py" \
-partitioner newjoin.NumericPartitioner -file "map_threeJoin.py" \
-cmdenv b_size=6 -cmdenv c_size=6
その重要な部分は NumericPartitioner.jar ファイルです。このファイルは、コマンドが実行されているのと同じフォルダー (Hadoop ルート インストールから下のレベル) にあります。コードは次のとおりです。
package newjoin;
import java.util.*;
import java.lang.*;
import org.apache.hadoop.mapreduce.*;
import org.apache.hadoop.io.*;
public class NumericPartitioner extends Partitioner<Text,Text>
{
@Override
public int getPartition(Text key,Text value,int numReduceTasks)
{
return Integer.parseInt(key.toString().split("\\s")[0]) % numReduceTasks;
}
}
それでも、上記のコマンドを実行しようとすると、次のようになります。
-partitioner : class not found : newjoin.NumericPartitioner
Streaming Command Failed!
ここで何が起こっているのですか? mapReduce でパーティショナーを見つけるにはどうすればよいですか?