I am currently trying to parse the hour from some twitter data. The timestamp in twitter is in epochseconds, and I am using a mapreduce programme to extract and sum the hour of the day that each tweet was posted. My java code compiles, and the hadoop job runs, however I get a blank output. After looking at the details of the hadoop job, it is telling me that merged map outputs = 0. I have tried everything and have no idea why this is not working. Even if I have not parsed the date correctly, I should still get a return of all of the tweets being recorded under time = 23, and this is the final else in my list of if else statements. I have put the code below:
public class TweetHourMapper extends Mapper<Object, Text, Text, IntWritable> {
private Text hour = new Text();
private IntWritable count = new IntWritable(1);
public void map(Object key, Text value, Context context) throws IOException, InterruptedException {
String[] fields = value.toString().split(";");
if (fields.length == 4) {
String date = fields[0];
Long aDate = Long.parseLong(date);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(aDate);
int time = calendar.get(Calendar.HOUR);
if (time == 0) {
hour.set("0");
context.write(hour, count);
//Below this i have a list of if else statements writing out if the time== the particular hour.