private void runPreUpgrade(String scriptDir, String scriptFile) {
    for (int i = 0;; i++) {
      String preUpgradeScript = schemaTool.getMetaStoreSchemaInfo().getPreUpgradeScriptName(i, scriptFile);
      File preUpgradeScriptFile = new File(scriptDir, preUpgradeScript);
      if (!preUpgradeScriptFile.isFile()) {
        break;
      }

      try {
        schemaTool.execSql(scriptDir, preUpgradeScript);
        System.out.println("Completed " + preUpgradeScript);
      } catch (Exception e) {
        // Ignore the pre-upgrade script errors
        System.err.println("Warning in pre-upgrade script " + preUpgradeScript + ": " + e.getMessage());
        if (schemaTool.isVerbose()) {
          e.printStackTrace();
        }
      }
    }
  }
Run pre-upgrade scripts corresponding to a given upgrade script,
 if any exist. The errors from pre-upgrade are ignored.
 Pre-upgrade scripts typically contain setup statements which
 may fail on some database versions and failure is ignorable.

 @param scriptDir upgrade script directory name
 @param scriptFile upgrade script file name
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/tools/schematool/SchemaToolTaskUpgrade.java