public static ObjectInspector getStandardObjectInspectorFromTypeInfo(TypeInfo typeInfo) {


    ObjectInspector oi = cachedObjectInspectors.getIfPresent(typeInfo);
    if (oi == null) {

      LOG.debug("Got asked for OI for {}, [{}]", typeInfo.getCategory(), typeInfo.getTypeName());
      switch (typeInfo.getCategory()) {
      case PRIMITIVE:
        oi = PrimitiveObjectInspectorFactory.getPrimitiveJavaObjectInspector(
            (PrimitiveTypeInfo) typeInfo);
        break;
      case STRUCT:
        StructTypeInfo structTypeInfo = (StructTypeInfo) typeInfo;
        List<String> fieldNames = structTypeInfo.getAllStructFieldNames();
        List<TypeInfo> fieldTypeInfos = structTypeInfo.getAllStructFieldTypeInfos();
        List<ObjectInspector> fieldObjectInspectors =
          new ArrayList<ObjectInspector>(fieldTypeInfos.size());
        for (int i = 0; i < fieldTypeInfos.size(); i++) {
          fieldObjectInspectors.add(getStandardObjectInspectorFromTypeInfo(fieldTypeInfos.get(i)));
        }
        oi = ObjectInspectorFactory.getStandardStructObjectInspector(
          fieldNames, fieldObjectInspectors
        );
        break;
      case LIST:
        ObjectInspector elementObjectInspector = getStandardObjectInspectorFromTypeInfo(
          ((ListTypeInfo) typeInfo).getListElementTypeInfo());
        oi = ObjectInspectorFactory.getStandardListObjectInspector(elementObjectInspector);
        break;
      case MAP:
        ObjectInspector keyObjectInspector = getStandardObjectInspectorFromTypeInfo(
          ((MapTypeInfo) typeInfo).getMapKeyTypeInfo());
        ObjectInspector valueObjectInspector = getStandardObjectInspectorFromTypeInfo(
          ((MapTypeInfo) typeInfo).getMapValueTypeInfo());
        oi = ObjectInspectorFactory.getStandardMapObjectInspector(keyObjectInspector, valueObjectInspector);
        break;
      default:
        oi = null;
      }
      cachedObjectInspectors.asMap().put(typeInfo, oi);
    }
    return oi;
  }
Returns HCatRecordObjectInspector given a StructTypeInfo type definition for the record to look into
@param typeInfo Type definition for the record to look into
@return appropriate HCatRecordObjectInspector
@throws SerDeException
hcatalog/core/src/main/java/org/apache/hive/hcatalog/data/HCatRecordObjectInspectorFactory.java