private void analyzeAlterTableProtectMode(ASTNode ast, String tableName,
HashMap<String, String> partSpec)
throws SemanticException {
AlterTableDesc alterTblDesc =
new AlterTableDesc(AlterTableTypes.ALTERPROTECTMODE);
alterTblDesc.setOldName(tableName);
alterTblDesc.setPartSpec(partSpec);
ASTNode child = (ASTNode) ast.getChild(0);
switch (child.getToken().getType()) {
case HiveParser.TOK_ENABLE:
alterTblDesc.setProtectModeEnable(true);
break;
case HiveParser.TOK_DISABLE:
alterTblDesc.setProtectModeEnable(false);
break;
default:
throw new SemanticException(
"Set Protect mode Syntax parsing error.");
}
ASTNode grandChild = (ASTNode) child.getChild(0);
switch (grandChild.getToken().getType()) {
case HiveParser.TOK_OFFLINE:
alterTblDesc.setProtectModeType(AlterTableDesc.ProtectModeType.OFFLINE);
break;
case HiveParser.TOK_NO_DROP:
alterTblDesc.setProtectModeType(AlterTableDesc.ProtectModeType.NO_DROP);
break;
case HiveParser.TOK_READONLY:
throw new SemanticException(
"Potect mode READONLY is not implemented");
default: