public static int getCharacterLengthForType(PrimitiveTypeInfo typeInfo) {
    switch (typeInfo.getPrimitiveCategory()) {
      case STRING:
        return HiveVarchar.MAX_VARCHAR_LENGTH;
      case CHAR:
      case VARCHAR:
        BaseCharTypeInfo baseCharTypeInfo = (BaseCharTypeInfo) typeInfo;
        return baseCharTypeInfo.getLength();
      default:
        return 0;
    }
  }
Return the character length of the type
@param typeInfo
@return
serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoUtils.java