私はカスタマイズできるコードを書き込もうとしていましたが、インプットはインプリメンテーションを使用して文字の長さに従って減速するパーティションはデフォルトのMapperとReducerがありますが、次のエラーが発生しています。私を助ける人には感謝します。Partitioner型のgetPartitionの名前の衝突は、MapReduce、Hadoopのmainクラスの型の消去と同じです。
int setNumRedTasks)
で
エラー:
名衝突:タイプ MyPartitionerの方法getPartition(オブジェクト、オブジェクト、INT)は 型パーティション分割のgetPartition(K2、V2、INT)と同様の消去を有するがありません上書きしないこと
コード:
package partition;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.Partitioner;
public abstract class MyPartitioner implements Partitioner<Text, IntWritable>{
@Override
public void configure(JobConf arg0) {
// TODO Auto-generated method stub
}
// @Override
public int getPartition(Object key, Object value, int setNumRedTasks) {
String s = key.toString();
if(s.length()==1)
{
return 0;
}
if(s.length()==2)
{
return 1;
}
if(s.length()==3)
{
return 2;
}
else
return 3;
}
}