private static CompactionType checkForCompaction(final CompactionInfo ci, final ValidWriteIdList writeIds,
      final StorageDescriptor sd, final Map<String, String> tblProperties, final String runAs, TxnStore txnHandler,
      HiveConf conf) throws IOException, InterruptedException {
    if (MetaStoreUtils.isIcebergTable(tblProperties)) {
      return ci.type;
    }

    // If it's marked as too many aborted, we already know we need to compact
    if (ci.tooManyAborts) {
      LOG.debug("Found too many aborted transactions for "
          + ci.getFullPartitionName() + ", " + "initiating major compaction");
      return CompactionType.MAJOR;
    }

    if (ci.hasOldAbort) {
      HiveConf.ConfVars oldAbortedTimeoutProp = HiveConf.ConfVars.HIVE_COMPACTOR_ABORTEDTXN_TIME_THRESHOLD;
      LOG.debug(
          "Found an aborted transaction for " + ci.getFullPartitionName() + " with age older than threshold "
              + oldAbortedTimeoutProp + ": " + conf.getTimeVar(oldAbortedTimeoutProp, TimeUnit.HOURS) + " hours. "
              + "Initiating minor compaction.");
      return CompactionType.MINOR;
    }
    AcidDirectory acidDirectory = AcidUtils.getAcidState(sd, writeIds, conf);
    long baseSize = getBaseSize(acidDirectory);
    FileSystem fs = acidDirectory.getFs();
    Map<Path, Long> deltaSizes = new HashMap<>();
    for (ParsedDelta delta : acidDirectory.getCurrentDirectories()) {
      deltaSizes.put(delta.getPath(), getDirSize(fs, delta));
    }
    long deltaSize = deltaSizes.values().stream().reduce(0L, Long::sum);
    AcidMetricService.updateMetricsFromInitiator(ci.dbname, ci.tableName, ci.partName, conf, txnHandler, baseSize,
        deltaSizes, acidDirectory.getObsolete());

    if (runJobAsSelf(runAs)) {
      return determineCompactionType(ci, acidDirectory, tblProperties, baseSize, deltaSize, conf);
    } else {
      LOG.info("Going to initiate as user " + runAs + " for " + ci.getFullPartitionName());
      UserGroupInformation ugi = UserGroupInformation.createProxyUser(runAs, UserGroupInformation.getLoginUser());
      CompactionType compactionType;
      try {
        compactionType = ugi.doAs(
            (PrivilegedExceptionAction<CompactionType>) () -> determineCompactionType(ci, acidDirectory, tblProperties,
                baseSize, deltaSize, conf));
      } finally {
        try {
          FileSystem.closeAllForUGI(ugi);
        } catch (IOException exception) {
          LOG.error("Could not clean up file-system handles for UGI: " + ugi + " for " + ci.getFullPartitionName(),
              exception);
        }
      }
      return compactionType;
    }
  }
Check for that special case when minor compaction is supported or not.
<ul>
  <li>The table is Insert-only OR</li>
  <li>Query based compaction is not enabled OR</li>
  <li>The table has only acid data in it.</li>
</ul>
@param tblProperties The properties of the table to check
@param dir The {@link AcidDirectory} instance pointing to the table's folder on the filesystem.
@return Returns true if minor compaction is supported based on the given parameters, false otherwise.
ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/CompactorUtil.java