public static void main(String[] args) throws Exception {
    Configuration conf = new Configuration();

    Options opts = createOptions();
    CommandLine cli = new GnuParser().parse(opts, args);

    if (cli.hasOption('h')) {
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp("fixacidkeyindex", opts);
      return;
    }

    Properties configProps = cli.getOptionProperties("hiveconf");
    for (String key: configProps.stringPropertyNames()) {
      conf.set(key, configProps.getProperty(key));
    }

    String backupPath = DEFAULT_BACKUP_PATH;
    if (cli.hasOption("backup-path")) {
      backupPath = cli.getOptionValue("backup-path");
    }

    boolean checkOnly = cli.hasOption("check-only");
    boolean recover = cli.hasOption("recover");

    String[] files = cli.getArgs();
    if (files.length == 0) {
      System.err.println("Error : ORC files are not specified");
      return;
    }

    // if the specified path is directory, iterate through all files
    List<String> filesInPath = new ArrayList<>();
    for (String filename : files) {
      Path path = new Path(filename);
      filesInPath.addAll(getAllFilesInPath(path, conf));
    }

    if (checkOnly) {
      checkFiles(conf, filesInPath);
    } else if (recover) {
      recoverFiles(conf, filesInPath, backupPath);
    } else {
      System.err.println("check-only or recover option must be specified");
    }
  }
Utility to check and fix the ACID key index of an ORC file if it has been written incorrectly
due to HIVE-18817.
The condition that will be checked in the ORC file will be if the number of stripes in the
acid key index matches the number of stripes in the ORC StripeInformation.
ql/src/java/org/apache/hadoop/hive/ql/io/orc/FixAcidKeyIndex.java