@Override
  // partSpec coming from the input is not applicable here as archiver gets its partitions from a different part of
  // the AST tree
  protected void analyzeCommand(TableName tableName, Map<String, String> partSpec, ASTNode command)
      throws SemanticException {
    if (!conf.getBoolVar(HiveConf.ConfVars.HIVE_ARCHIVE_ENABLED)) {
      throw new SemanticException(ErrorMsg.ARCHIVE_METHODS_DISABLED.getMsg());
    }

    Table table = getTable(tableName);
    validateAlterTableType(table, AlterTableType.ARCHIVE, false);

    List<Map<String, String>> partitionSpecs = getPartitionSpecs(table, command);
    if (partitionSpecs.size() > 1) {
      throw new SemanticException(getMultiPartsErrorMessage().getMsg());
    }
    if (partitionSpecs.size() == 0) {
      throw new SemanticException(ErrorMsg.ARCHIVE_ON_TABLE.getMsg());
    }

    Map<String, String> partitionSpec = partitionSpecs.get(0);
    try {
      isValidPrefixSpec(table, partitionSpec);
    } catch (HiveException e) {
      throw new SemanticException(e.getMessage(), e);
    }

    inputs.add(new ReadEntity(table));
    PartitionUtils.addTablePartsOutputs(db, outputs, table, partitionSpecs, true, WriteEntity.WriteType.DDL_NO_LOCK);

    DDLDesc archiveDesc = createDesc(tableName, partitionSpec);
    rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), archiveDesc)));
  }
Abstract ancestor of analyzer for archive / unarchive commands for tables.
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/storage/archive/AbstractAlterTableArchiveAnalyzer.java