I have a sample input file as below which contains a sequence number, name, medicine, gender, amount spent. My requirement is to get the total amount spent on each medicine. I have written a Mapreduce program and ran it in my local machine under a Single Node cluster with Hadoop and other necessary packages installed.
- Irma Ellison,avil,female,872
- Hilary Bush,avil,male,999
- Ahmed Mejia,paracetamol,female,654
- Grace Boone,metacin,female,918
- Hayes Ortiz,paracetamol,male,734
- Lani Matthews,paracetamol,female,836
- Cathleen Stewart,paracetamol,male,178
- Jonas Boone,metacin,female,649
- Desiree Pearson,avil,male,439
- Britanney Sullivan,metacin,female,659
for the above input i am expecting the output as below.
avil 2310
metacin 2226
paracetamol 2402
When I declare my reducer class as
public class VisReducer extends Reducer < Text, IntWritable, Text, IntWritable > . I am getting my expected output and everything looks good.
But mistakenly I have changed my reducer class declaration as
public class VisReducer extends Reducer< Text, Iterable< IntWritable >, Text, IntWritable > . The output seems to be just a Mapper output and looks like for some reason, reduce method in the Reduceer class has not run. I have added a System.out.println() in reduce method, and checked the logs and could not see what I printed, Whereas in the first case, I can see the output. nI am not able to understand what is causing the issue.
Can someone help me to understand what exactly is happening.
Output in my second case.
avil 439
avil 999
avil 872
metacin 659
metacin 649
metacin 918
paracetamol 178
paracetamol 836
paracetamol 734
paracetamol 654
It might be a very basic question as i am just starting my hadoop learning and could not find any relevant quetions online.