Reputation: 195
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)?
Upvotes: 0
Views: 2071
Reputation: 75
You cannot output a null value. You can output a null key though:
context.write(null, new Text(outkeystr));
Upvotes: 0
Reputation: 4681
You can't use the explict value null
but you can use a NullWritable
class if you don't care about the Value
Upvotes: 2