use of org.apache.hadoop.hive.ql.ddl.DDLDesc in project hive by apache.
the class AbstractAlterTableArchiveAnalyzer method analyzeCommand.
@Override
protected // the AST tree
void analyzeCommand(TableName tableName, Map<String, String> partSpec, ASTNode command) throws SemanticException {
if (!conf.getBoolVar(HiveConf.ConfVars.HIVEARCHIVEENABLED)) {
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)));
}
Aggregations