public static boolean hasAllFieldsSettable(ObjectInspector oi,
      Map<ObjectInspector, Boolean> oiSettableProperties) {
    // If the result is already present in the cache, return it.
    if (!(oiSettableProperties == null) &&
        oiSettableProperties.containsKey(oi)) {
      return oiSettableProperties.get(oi).booleanValue();
    }
    // If the top-level object inspector is non-settable return false
    if (!(isInstanceOfSettableOI(oi))) {
      return setOISettablePropertiesMap(oi, oiSettableProperties, false);
    }

    Boolean returnValue = true;

    switch (oi.getCategory()) {
    case PRIMITIVE:
      break;
    case STRUCT:
      StructObjectInspector structOutputOI = (StructObjectInspector) oi;
      List<? extends StructField> listFields = structOutputOI.getAllStructFieldRefs();
      for (StructField listField : listFields) {
        if (!hasAllFieldsSettable(listField.getFieldObjectInspector(), oiSettableProperties)) {
          returnValue = false;
          break;
        }
      }
      break;
    case LIST:
      ListObjectInspector listOutputOI = (ListObjectInspector) oi;
      returnValue = hasAllFieldsSettable(listOutputOI.getListElementObjectInspector(),
          oiSettableProperties);
      break;
    case MAP:
      MapObjectInspector mapOutputOI = (MapObjectInspector) oi;
      returnValue = hasAllFieldsSettable(mapOutputOI.getMapKeyObjectInspector(), oiSettableProperties) &&
          hasAllFieldsSettable(mapOutputOI.getMapValueObjectInspector(), oiSettableProperties);
      break;
    case UNION:
      UnionObjectInspector unionOutputOI = (UnionObjectInspector) oi;
      List<ObjectInspector> unionListFields = unionOutputOI.getObjectInspectors();
      for (ObjectInspector listField : unionListFields) {
        if (!hasAllFieldsSettable(listField, oiSettableProperties)) {
          returnValue = false;
          break;
        }
      }
      break;
    default:
      throw new RuntimeException("Hive internal error inside hasAllFieldsSettable : "
          + oi.getTypeName() + " not supported yet.");
    }
    return setOISettablePropertiesMap(oi, oiSettableProperties, returnValue);
  }
@param oi - Input object inspector
@param oiSettableProperties - Lookup map to cache the result.(If no caching, pass null)
@return - true if : (1) oi is an instance of settable&lt;DataType&gt;OI.
                    (2) All the embedded object inspectors are instances of settable&lt;DataType&gt;OI.
          If (1) or (2) is false, return false.
serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorUtils.java