public static Object getWritableObject(TypeInfo typeInfo,
      ObjectInspector objectInspector, Object object) {

    final Category category = typeInfo.getCategory();
    switch (category) {
    case PRIMITIVE:
      return
          getWritablePrimitiveObject(
              (PrimitiveTypeInfo) typeInfo,
              objectInspector, DataTypePhysicalVariation.NONE, object);
    case STRUCT:
      {
        final StructTypeInfo structTypeInfo = (StructTypeInfo) typeInfo;
        final StandardStructObjectInspector structInspector =
            (StandardStructObjectInspector) objectInspector;
        final List<TypeInfo> fieldTypeInfos = structTypeInfo.getAllStructFieldTypeInfos();
        final int size = fieldTypeInfos.size();
        final List<? extends StructField> structFields =
            structInspector.getAllStructFieldRefs();

        List<Object> input = (ArrayList<Object>) object;
        List<Object> result = new ArrayList<Object>(size);
        for (int i = 0; i < size; i++) {
          final StructField structField = structFields.get(i);
          final TypeInfo fieldTypeInfo = fieldTypeInfos.get(i);
          result.add(
              getWritableObject(
                  fieldTypeInfo, structField.getFieldObjectInspector(), input.get(i)));
        }
        return result;
      }
    default:
      throw new RuntimeException("Unexpected category " + category);
    }
  }
Generate object inspector and random row object[].
ql/src/test/org/apache/hadoop/hive/ql/exec/vector/VectorRandomRowSource.java