public static ObjectInspector getWritableObjectInspector(ObjectInspector oi) {
    // All non-primitive OIs are writable so we need only check this case.
    if (oi.getCategory() == Category.PRIMITIVE) {
      PrimitiveObjectInspector poi = (PrimitiveObjectInspector) oi;
      if (!(poi instanceof AbstractPrimitiveWritableObjectInspector)) {
        return PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(
            poi.getTypeInfo());
      }
    }
    return oi;
  }
Ensures that an ObjectInspector is Writable.
serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorUtils.java