public static void generateOrcFile(Configuration conf, FileSystem fs, Path outputPath,
      Class recordClass)
      throws IOException, InstantiationException,
      IllegalAccessException, InvocationTargetException {

    ObjectInspector inspector;
    synchronized (TestVectorizedORCReader.class) {
      inspector = ObjectInspectorFactory.getReflectionObjectInspector(
          recordClass, ObjectInspectorFactory.ObjectInspectorOptions.JAVA);
    }

    Writer writer = OrcFile.createWriter(
        fs,
        outputPath,
        conf,
        inspector,
        100000,
        CompressionKind.ZLIB,
        10000,
        10000);

    try {
      Constructor[] constructors = recordClass.getConstructors();

      if (constructors.length != 1) {
        throw new UnsupportedOperationException(
            "The provided recordClass must have exactly one constructor.");
      }

      BatchDataDistribution[] dataDist = BatchDataDistribution.values();
      Class[] columns = constructors[0].getParameterTypes();
      for (int i = 0; i < dataDist.length * 3; i++) {
        Object[][] rows = new Object[columns.length][VectorizedRowBatch.DEFAULT_SIZE];
        for (int c = 0; c < columns.length; c++) {
          if (!TYPE_TO_BATCH_GEN_MAP.containsKey(columns[c])) {
            throw new UnsupportedOperationException("No batch generator defined for type "
                + columns[c].getName());
          }
          rows[c] = TYPE_TO_BATCH_GEN_MAP.get(
              columns[c]).generateBatch(dataDist[(i + c) % dataDist.length]);
        }

        for (int r = 0; r < VectorizedRowBatch.DEFAULT_SIZE; r++) {
          Object[] row = new Object[columns.length];
          for (int c = 0; c < columns.length; c++) {
            row[c] = rows[c][r];
          }
          writer.addRow(
              constructors[0].newInstance(row));
        }
      }
    } finally {
      writer.close();
    }
  }
Generates an orc file based on the provided record class in the specified file system
at the output path.

@param conf the configuration used to initialize the orc writer
@param fs the file system to which will contain the generated orc file
@param outputPath the path where the generated orc will be placed
@param recordClass a class the defines the record format for the generated orc file, this
class must have exactly one constructor.
ql/src/test/org/apache/hadoop/hive/ql/exec/vector/util/OrcFileGenerator.java