public static CompactionType dbCompactionType2ThriftType(char dbValue) throws SQLException {
    switch (dbValue) {
      case TxnStore.MAJOR_TYPE:
        return CompactionType.MAJOR;
      case TxnStore.MINOR_TYPE:
        return CompactionType.MINOR;
      case TxnStore.REBALANCE_TYPE:
        return CompactionType.REBALANCE;
      case TxnStore.ABORT_TXN_CLEANUP_TYPE:
        return CompactionType.ABORT_TXN_CLEANUP;
      case TxnStore.SMART_OPTIMIZE_TYPE:
        return CompactionType.SMART_OPTIMIZE;
      default:
        throw new SQLException("Unexpected compaction type " + dbValue);
    }
  }
Determine which user to run an operation as. If metastore.compactor.run.as.user is set, that user will be
returned; if not: the the owner of the directory to be compacted.
It is asserted that either the user running the hive metastore or the table
owner must be able to stat the directory and determine the owner.
@param location directory that will be read or written to.
@param t metastore table object
@return metastore.compactor.run.as.user value; or if that is not set: username of the owner of the location.
@throws java.io.IOException if neither the hive metastore user nor the table owner can stat
the location.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnUtils.java