// Alter table ... partition column ( column newtype) only takes one column at a time.
// It must have a column name followed with type.
ASTNode colAst = (ASTNode) ast.getChild(1);
assert(colAst.getChildCount() == 2);
FieldSchema newCol = new FieldSchema();
// get column name
String name = colAst.getChild(0).getText().toLowerCase();
newCol.setName(unescapeIdentifier(name));
// get column type
ASTNode typeChild = (ASTNode) (colAst.getChild(1));
newCol.setType(getTypeStringFromAST(typeChild));
// check if column is defined or not
boolean fFoundColumn = false;
for( FieldSchema col : tab.getTTable().getPartitionKeys()) {
if (col.getName().compareTo(newCol.getName()) == 0) {
fFoundColumn = true;
}
}
// raise error if we could not find the column
if (!fFoundColumn) {
throw new SemanticException(ErrorMsg.INVALID_COLUMN.getMsg(newCol.getName()));
}
AlterTableAlterPartDesc alterTblAlterPartDesc =
new AlterTableAlterPartDesc(SessionState.get().getCurrentDatabase(), tblName, newCol);