public static CompactionResponse initiateCompactionForPartition(Table table, Partition partition,
      CompactionRequest compactionRequest, String hostName, TxnStore txnHandler, HiveConf inputConf) 
      throws MetaException {
    ValidTxnList validTxnList = TxnCommonUtils.createValidReadTxnList(txnHandler.getOpenTxns(), 0);
    HiveConf conf = new HiveConf(inputConf);
    conf.set(ValidTxnList.VALID_TXNS_KEY, validTxnList.writeToString());
    CompactionResponse compactionResponse;
    CompactionInfo compactionInfo =
        new CompactionInfo(table.getDbName(), table.getTableName(), compactionRequest.getPartitionname(),
            compactionRequest.getType());
    compactionInfo.initiatorId = compactionRequest.getInitiatorId();
    compactionInfo.orderByClause = compactionRequest.getOrderByClause();
    compactionInfo.initiatorVersion = compactionRequest.getInitiatorVersion();
    if (compactionRequest.getNumberOfBuckets() > 0) {
      compactionInfo.numberOfBuckets = compactionRequest.getNumberOfBuckets();
    }
    compactionInfo.poolName = compactionRequest.getPoolName();
    try {
      StorageDescriptor sd = resolveStorageDescriptor(table, partition);
      String runAs = TxnUtils.findUserToRunAs(sd.getLocation(), table, conf);
      LOG.info("Checking to see if we should compact partition {} of table {}.{}", compactionInfo.partName,
          table.getDbName(), table.getTableName());
      compactionResponse =
          scheduleCompactionIfRequired(compactionInfo, table, partition, runAs, false, hostName,
              txnHandler, conf);
    } catch (IOException | InterruptedException | MetaException e) {
      LOG.error("Error occurred while Checking if we should compact partition {} of table {}.{} Exception: {}",
          compactionInfo.partName, table.getDbName(), table.getTableName(), e.getMessage());
      throw new RuntimeException(e);
    }
    return compactionResponse;
  }
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