private static Object serializePrimitiveField(Object field,
      ObjectInspector fieldObjectInspector) {
    if (field == null) {
      return null;
    }
    Object f = ((PrimitiveObjectInspector) fieldObjectInspector).getPrimitiveJavaObject(field);
    if (f != null && HCatContext.INSTANCE.getConf().isPresent()) {
      Configuration conf = HCatContext.INSTANCE.getConf().get();

      if (f instanceof Boolean &&
        conf.getBoolean(
          HCatConstants.HCAT_DATA_CONVERT_BOOLEAN_TO_INTEGER,
          HCatConstants.HCAT_DATA_CONVERT_BOOLEAN_TO_INTEGER_DEFAULT)) {
        return ((Boolean) f) ? 1 : 0;
      } else if (f instanceof Short &&
        conf.getBoolean(
          HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION,
          HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION_DEFAULT)) {
        return Integer.valueOf((Short) f);
      } else if (f instanceof Byte &&
        conf.getBoolean(
          HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION,
          HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION_DEFAULT)) {
        return Integer.valueOf((Byte) f);
      }
    }

    return f;
  }
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