protected SessionState setupQueryCompactionSession(HiveConf conf, CompactionInfo compactionInfo, Map<String, String> tblProperties) {
    String queueName = HiveConf.getVar(conf, HiveConf.ConfVars.COMPACTOR_JOB_QUEUE);
    if (queueName != null && queueName.length() > 0) {
      conf.set(TezConfiguration.TEZ_QUEUE_NAME, queueName);
    }
    Util.disableLlapCaching(conf);
    conf.setBoolVar(HiveConf.ConfVars.HIVE_MATERIALIZED_VIEW_ENABLE_AUTO_REWRITING, false);
    conf.set(HiveConf.ConfVars.HIVE_QUOTEDID_SUPPORT.varname, "column");
    conf.setBoolVar(HiveConf.ConfVars.HIVE_SERVER2_ENABLE_DOAS, true);
    conf.setBoolVar(HiveConf.ConfVars.HIVE_HDFS_ENCRYPTION_SHIM_CACHE_ON, false);
    overrideConfProps(conf, compactionInfo, tblProperties);
    
    String user = compactionInfo.runAs;
    SessionState sessionState = DriverUtils.setUpAndStartSessionState(conf, user);
    sessionState.setCompaction(true);
    
    return sessionState;
  }
This is the final step of the compaction, which can vary based on compaction type. Usually this involves some file
operation.
@param tmpTableName The name of the temporary table.
@param conf hive configuration.
@throws IOException failed to execute file system operation.
@throws HiveException failed to execute file operation within hive.
ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/QueryCompactor.java