public static void checkInterrupted(DriverState driverState, DriverContext driverContext, String msg,
      HookContext hookContext, PerfLogger perfLogger) throws CommandProcessorException {
    if (driverState.isAborted()) {
      String errorMessage = "FAILED: command has been interrupted: " + msg;
      CONSOLE.printError(errorMessage);
      if (hookContext != null) {
        try {
          invokeFailureHooks(driverContext, perfLogger, hookContext, errorMessage, null);
        } catch (Exception e) {
          LOG.warn("Caught exception attempting to invoke Failure Hooks", e);
        }
      }
      throw createProcessorException(driverContext, 1000, errorMessage, "HY008", null);
    }
  }
For Query Based compaction to run the query to generate the compacted data.
ql/src/java/org/apache/hadoop/hive/ql/DriverUtils.java