title: How to just output value in context.write(k,v)
body: <p>In my mapreduce job, I just want to output some lines.</p>
  
  <p>But if I code like this:
      context.write(data, null);</p>
  
  <p>the program will throw java.lang.NullPointerException.</p>
  
  <p>I don't want to code like below:
      context.write(data, new Text(""));</p>
  
  <p>because I have to trim the blank space in every line in the output files.</p>
  
  <p>Is there any good ways to solve it?
  Thanks in advance.</p>
  
  <hr>
  
  <p>Sorry, it's my mistake. I checked the program carefully, found the reason is I set the Reducer as combiner.</p>
  
  <p>If I do not use the combiner, the statement 
      context.write(data, null); 
  in reducer works fine. In the output data file, there is just the data line.</p>
  
  <hr>
  
  <p>Share the NullWritable explanation from hadoop definitive guide:</p>
  
  <p>NullWritable is a special type of Writable, as it has a zero-length serialization. No bytes
  are written to, or read from, the stream. It is used as a placeholder; for example, in
  MapReduce, a key or a value can be declared as a NullWritable when you don’t need
  to use that position—it effectively stores a constant empty value. NullWritable can also
  be useful as a key in SequenceFile when you want to store a list of values, as opposed
  to key-value pairs. It is an immutable singleton: the instance can be retrieved by calling
  NullWritable.get().</p>