@Override
  protected Message toMessage(Writable writable) throws SerDeException {
    try {
      BytesWritable bytes = (BytesWritable)writable;
      return parser.parseFrom(bytes.getBytes(), 0, bytes.getLength());
    } catch (InvalidProtocolBufferException e) {
      throw new SerDeException("Unable to parse proto message", e);
    }
  }
Class to convert bytes writable containing a protobuf message to hive formats.
@see ProtobufSerDe
ql/src/java/org/apache/hadoop/hive/ql/io/protobuf/ProtobufBytesWritableSerDe.java