public static Type getType(TypeInfo typeInfo) {
    switch (typeInfo.getCategory()) {
    case PRIMITIVE: {
      PrimitiveTypeInfo pTypeInfo = (PrimitiveTypeInfo) typeInfo;
      switch (pTypeInfo.getPrimitiveCategory()) {
      case VOID: {
        return Type.NULL_TYPE;
      }
      case BOOLEAN: {
        return Type.BOOLEAN_TYPE;
      }
      // Double check if this is the right mapping
      case BYTE: {
        return Type.BINARY_TYPE;
      }
      // Double check if this is the right mapping
      case SHORT: {
        return Type.SMALLINT_TYPE;
      }
      case INT: {
        return Type.INT_TYPE;
      }
      // Double check if this is the right mapping
      case LONG: {
        return Type.BIGINT_TYPE;
      }
      case FLOAT: {
        return Type.FLOAT_TYPE;
      }
      case DOUBLE: {
        return Type.DOUBLE_TYPE;
      }
      case STRING: {
        return Type.STRING_TYPE;
      }
      case CHAR: {
        return Type.CHAR_TYPE;
      }
      case VARCHAR: {
        return Type.VARCHAR_TYPE;
      }
      case BINARY: {
        return Type.BINARY_TYPE;
      }
      case DATE: {
        return Type.DATE_TYPE;
      }
      case TIMESTAMP: {
        return Type.TIMESTAMP_TYPE;
      }
      case TIMESTAMPLOCALTZ: {
        return Type.TIMESTAMPLOCALTZ_TYPE;
      }
      case INTERVAL_YEAR_MONTH: {
        return Type.INTERVAL_YEAR_MONTH_TYPE;
      }
      case INTERVAL_DAY_TIME: {
        return Type.INTERVAL_DAY_TIME_TYPE;
      }
      case DECIMAL: {
        return Type.DECIMAL_TYPE;
      }
      default: {
        throw new RuntimeException("Unrecognized type: " + pTypeInfo.getPrimitiveCategory());
      }
      }
    }
    // Double check if this is the right mapping
    case LIST: {
      return Type.STRING_TYPE;
    }
    case MAP: {
      return Type.MAP_TYPE;
    }
    case STRUCT: {
      return Type.STRUCT_TYPE;
    }
    case UNION: {
      return Type.UNION_TYPE;
    }
    default: {
      throw new RuntimeException("Unrecognized type: " + typeInfo.getCategory());
    }
    }
  }
Convert TypeInfo to appropriate Type
@param typeInfo
@return
serde/src/java/org/apache/hadoop/hive/serde2/thrift/Type.java