private ObjectInspector getMapObjectInspector(Descriptor descriptor,
      Map<Descriptor, ObjectInspector> cache) throws SerDeException {
    List<FieldDescriptor> fields = descriptor.getFields();
    if (fields.size() != 2) {
      throw new SerDeException("Map type " + descriptor.getFullName() +
          " should have only 2 fields, got: " + fields.size());
    }
    ObjectInspector keyOI = createObjectInspector(fields.get(0), cache);
    ObjectInspector valueOI = createObjectInspector(fields.get(1), cache);
    return ObjectInspectorFactory.getStandardMapObjectInspector(keyOI, valueOI);
  }
Convert the given writable to a message.
@param writable The writable object containing the message.
@return The converted message object.
@throws SerDeException
ql/src/java/org/apache/hadoop/hive/ql/io/protobuf/ProtobufSerDe.java