Basic syntax:
ALTER TABLE name RENAME TO new_name ALTER TABLE name ADD COLUMNS (col_spec[, col_spec ...]) ALTER TABLE name DROP [COLUMN] column_name ALTER TABLE name CHANGE column_name new_name new_type ALTER TABLE name REPLACE COLUMNS (col_spec[, col_spec ...])refer: https://www.yiibai.com/hive/hive_alter_table.html
Experiment yourself:
1. alter table d_extra.dm_usr_mxdai_risk_analysis add columns(test1 int, test2 int); ------works
desc d_extra.dm_usr_mxdai_risk_analysis;
It can be seen that the new field has been added successfully
1.1. alter table d_extra.dm_usr_mxdai_risk_analysis add column test1 int; ------doesn't work
2. alter table d_extra.dm_usr_mxdai_risk_analysis drop column test1; -----doesn't work
Error:
Error: Error while compiling statement: FAILED: ParseException line 1:52 mismatched input 'column' expecting PARTITION near 'drop' in drop partition statement (state=42000,code=40000)
Is it only possible to drop partition but not drop column? ?
3. alter table d_extra.dm_usr_mxdai_risk_analysis change test1 risk_1_138 string; ------works