public static Object[] randomWritablePrimitiveRow(
      int columnCount, Random r, PrimitiveTypeInfo[] primitiveTypeInfos) {

    final Object row[] = new Object[columnCount];
    for (int c = 0; c < columnCount; c++) {
      final PrimitiveTypeInfo primitiveTypeInfo = primitiveTypeInfos[c];
      final ObjectInspector objectInspector =
          PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(primitiveTypeInfo);
      final Object object = randomPrimitiveObject(r, primitiveTypeInfo);
      row[c] = getWritablePrimitiveObject(primitiveTypeInfo, objectInspector, object);
    }
    return row;
  }
Generate object inspector and random row object[].
serde/src/test/org/apache/hadoop/hive/serde2/SerdeRandomRowSource.java