private static Object toStringFamilyObject(TypeInfo typeInfo, String string, boolean isWritable) {

    PrimitiveTypeInfo primitiveTypeInfo = (PrimitiveTypeInfo) typeInfo;
    PrimitiveCategory primitiveCategory =
        primitiveTypeInfo.getPrimitiveCategory();
    Object object;
    switch (primitiveCategory) {
    case STRING:
      if (isWritable) {
        object = new Text(string);
      } else {
        object = string;
      }
      break;
    case CHAR:
      {
        HiveChar hiveChar =
            new HiveChar(
                string, ((CharTypeInfo) typeInfo).getLength());
        if (isWritable) {
          object = new HiveCharWritable(hiveChar);
        } else {
          object = hiveChar;
        }
      }
      break;
    case VARCHAR:
      {
        HiveVarchar hiveVarchar =
            new HiveVarchar(
                string, ((VarcharTypeInfo) typeInfo).getLength());
        if (isWritable) {
          object = new HiveVarcharWritable(hiveVarchar);
        } else {
          object = hiveVarchar;
        }
      }
      break;
    default:
      throw new RuntimeException("Unexpected string family category " + primitiveCategory);
    }
    return object;
  }
Generate object inspector and random row object[].
ql/src/test/org/apache/hadoop/hive/ql/exec/vector/VectorRandomRowSource.java