私はhadoopで非常に新しいです。マッパーに次のような入力 int が必要です。
1 2 3 4//////6 7 8
3 3 2 1//////5 9 0
=====////////-----
キー ///////// 値
キーの最初の 4 番目と値の次の 3 番目の数字? マッパークラスのJavaでそれを書くのを手伝ってくれませんか?
ファイルから読みたくありません。
「ファイルから読みたくない」とはどういう意味かわかりません。ファイルから各行を読み取り、各行を「//////」で分割する必要があると思います。
public static class MapClass extends MapReduceBase implements
Mapper<LongWritable, Text, Text, Text> {
private Text word = new Text();
public void map(LongWritable key, Text value,
OutputCollector<Text, Text> output, Reporter reporter)
throws IOException {
String line = value.toString();
StringTokenizer tokenizer = new StringTokenizer(line, "//////",
false);
word.set("key:"+tokenizer.nextToken());
output.collect(word, new Text("value="+tokenizer.nextToken()));
}
}