Hive的表添加和修改表字段,通过使用关键字alter和change等个关键字。
- 添加HIVE表字段
语法:alter table 表名 add columns('特征字段' '特征字段对应的类型')
比如:
alter table idl.i all day uid feature add columns(
uid_data_labt_cust_type string comment '客群'
,uid_is_qult_cmp string comment '客户认定'
,uid_qult_cmp_type string comment '单位类别'
)
ALTER TABLE idl.i_all_day_uid_feature change casescases array<map<string,string>>after uid_qult_cmp_type;
- 修改表字段类型
语法:alter table 表名 change column 原字段名称 新字段名称 新字段类型
比如:alter table idl.i_all_day_uid_feature change column last_phone_un_reg_time last_phone_un_reg_time string;
网友评论