I'm compiling a java file for word count hadoop, but when it's compiling it throws an error:
CountBook.java:33: error: expected public void reduce(Text_key,Iteratorvalues,OutputCollectoroutput,Reporter reporter)throws IOException
this is my code
public class CountBook
{
public static class EMapper extends MapReducebase implements
Mapper<LongWritable,Text,Text,IntWritable>
{
private final static Intwritable one = new Intwritable(1);
public void map(LongWritable key,Text value,OutputCollector<Text,IntWritable>output,Reporter reporter)throws IOException
{
String line = value.toString();
String[] Data = line.split("\";\"");
output.collect(new text(Data[0]),one);
}
}
public static class EReduce extends MapReduceBase implements
Reducer<Text,IntWritable,Text,IntWritable>
{
public void reduce(Text_key,Iterator<IntWritable>values,OutputCollector<text,intWritable>output,Reporter reporter)throws IOException
{
Text key=_key;
int authid=0;
while(values.hasNext())
{
IntWritable value = (IntWritable)values.next();
authid+=value.get();
}
output.collect(key,new intWritable(authid));
}
}
public static void main(String args[])throws Exception
{
JobConf conf = new JbConf(CountBook.class);
conf.setjobName("CountBookByAuthor");
conf.setOutputkeyClass(Text.class);
conf.setOutputValueClass(IntWritable.class);
conf.setMapperClass(EMapper.class);
conf.setCombinerClass(EReduce.class);
conf.setReducerClass(EReducer.class);
conf.setOutputFormat(TextOutputFormat.class);
FileInputFormat.setInputPaths(conf,new path(args[0]));
FileOutputFormat.setOutputPath(conf,new Path(args[1]));
JobCLient.runJob(conf);
}
}
I'm using hadoop-core-1.2.1.jar for classpath library and running in centos 7