0
public class SelfPatient {
public static class selfMapper1 extends Mapper<LongWritable,Text,Text,IntWritable>
{
public void map(LongWritable key,Text value,Context context) throws IOException,InterruptedException
{
//IntWritable clas =new IntWritable(Integer.parseInt(str.nextToken(",")));
String Line=value.toString();
String[] elements=Line.split(",");
int surv=Integer.parseInt(elements[1]);
Text clas=new Text(elements[4]);
//int i=Integer.parseInt(elements[0]);
//IntWritable number=new IntWritable(i);
context.write(new Text(clas),new IntWritable(surv));
//context.write(clas,number);
}
}
public static class selfReducer1 extends Reducer<Text,IntWritable,Text,IntWritable>
{
public void reduce(Text key,Iterable<IntWritable> values,Context context) throws IOException,InterruptedException
{
int sum=0;
for (IntWritable val :values)
{
sum += val.get();
}
context.write(key, new IntWritable(sum));
}
}
DataSetBenim MapReducer işçi Değil değildir çıkış
Ben çıktı almak istiyorum"","survive","cases","age","sex","class"
"1",1,1,0,0,1
"2",13,13,0,0,2
"3",14,31,0,0,3
"4",5,5,0,1,1
"5",11,11,0,1,2
"6",13,48,0,1,3
"7",140,144,1,0,1
"8",80,93,1,0,2
"9",76,165,1,0,3
"10",57,175,1,1,1
"11",14,168,1,1,2
"12",75,462,1,1,3
alma: Her class..example sınıfa 1-45 ölenlerin toplam sayısı, sınıf 2-34. Kodumdaki sorun nedir?
Yine aynı sorun ortaya çıkıyor.Reducer başlatılmıyor, boş çıktı gösteriyor. 16/04/08 21:10:26 BİLGİ mapreduce.Job: İşi izlemek için url: http: // ubuntu: 8088/proxy/application_1460174646477_0001/Ama bölme sayısını görebilirsiniz. Temp dosyası bile oluşturulmuyor .. –
Redüktör sınıfınızı Sürücü'de mi ayarlıyorsunuz? Sürücü kodunu paylaşabilir misiniz. – SurjanSRawat
Soruyu sürücü dosyanızla güncelleyin. Düzeltme sonrası mapper ve redüktör iyi görünüyor. – mfmz