@Override
      public void write(Writable r) throws IOException {
        if (keyIsText) {
          Text text = (Text) r;
          keyWritable.set(text.getBytes(), 0, text.getLength());
        } else {
          BytesWritable bw = (BytesWritable) r;
          // Once we drop support for old Hadoop versions, change these
          // to getBytes() and getLength() to fix the deprecation warnings.
          // Not worth a shim.
          keyWritable.set(bw.get(), 0, bw.getSize());
        }
        keyWritable.setHashCode(r.hashCode());
        outStream.append(keyWritable, NULL_WRITABLE);
      }
A {@link HiveOutputFormat} that writes {@link SequenceFile}s with the
content saved in the keys, and null in the values.
ql/src/java/org/apache/hadoop/hive/ql/io/HiveNullValueSequenceFileOutputFormat.java