0
votes

I just want to use hadoop mapreduce to sort my lines of log. I put all fields of the line as the output key, and set output value as null. But when run, null pointer exception is raised at line

context.write(new Text(outkeystr), null);

So why can't output value of hadoop map be null? Why output value of hadoop reduce can (I tested)?

2

2 Answers

2
votes

You can't use the explict value null but you can use a NullWritable class if you don't care about the Value

0
votes

You cannot output a null value. You can output a null key though:

context.write(null, new Text(outkeystr));