(1)修改字段名方法:
ALTER TABLE 表名 CHANGE 旧字段 新字段 类型;
(2)新增字段:use mart_flow_test;
alter table detail_flow_test add columns(original_union_id string);
或者:alter table 表名 add columns (列名 STRING COMMENT ‘Department name’);
alter table detail_flow_test add columns (original_old string Comment ‘哈哈’)
(3)修改注释:use original_union_id;
alter table detail_flow_test change column original_union_id original_union_id string COMMENT ‘原始设备唯一性标识’;
(4)Hive 添加表字段,给字段排序
ALTER TABLE 表名 CHANGE column col_old_name col_new_name column_type [COMMENT col_comment] after 列名(放在哪个字段后);
实例:把original_union_id 放到 original_old 后面
ALTER TABLE detail_flow_test CHANGE column original_union_id original_union_id string after original_old
(5) 重命名分区
ALTER TABLE table_name PARTITION partition_spec RENAME TO PARTITION partiti