private Task<?> getTask(MergeFileWork mergeWork) {
    if (context.getConf().getVar(ConfVars.HIVE_EXECUTION_ENGINE).equals("tez")) {
      TezWork tezWork = new TezWork(context.getQueryState().getQueryId(), context.getConf());
      mergeWork.setName("File Merge");
      tezWork.add(mergeWork);
      Task<?> task = new TezTask();
      ((TezTask) task).setWork(tezWork);
      return task;
    } else {
      Task<?> task = new MergeFileTask();
      ((MergeFileTask) task).setWork(mergeWork);
      return task;
    }
  }
Operation process of concatenating the files of a table/partition.
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/storage/concatenate/AlterTableConcatenateOperation.java