private static Map<?, ?> serializeMap(Object f, MapObjectInspector moi) throws SerDeException {
    ObjectInspector koi = moi.getMapKeyObjectInspector();
    ObjectInspector voi = moi.getMapValueObjectInspector();
    Map<Object, Object> m = new LinkedHashMap<Object, Object>();

    Map<?, ?> readMap = moi.getMap(f);
    if (readMap == null) {
      return null;
    } else {
      for (Map.Entry<?, ?> entry : readMap.entrySet()) {
        m.put(serializeField(entry.getKey(), koi), serializeField(entry.getValue(), voi));
      }
    }
    return m;
  }
Helper method to return underlying Java Map from
an object-representation that is readable by a provided
MapObjectInspector
hcatalog/core/src/main/java/org/apache/hive/hcatalog/data/HCatRecordSerDe.java