hive分区表中表字段操作

1. hive分区表中新增字段

alter table table_name add columns (column_new_name column_new_type [comment 'comment']);

-- 实例
alter table db.own_cust add columns (login_cnt int comment '登录次数', logintime string comment '登录时间');

2. hive中修改字段名、字段类型、字段顺序

    # hive中,只能先新增字段后,再进行排序操作。

ALTER TABLE table_name [PARTITION partition_spec] CHANGE [COLUMN] col_old_name col_new_name column_type
[COMMENT col_comment] [FIRST|AFTER column_name] [CASCADE|RESTRICT];

-- 实例1(修改列名)

猜你喜欢

转载自www.cnblogs.com/tianxiong/p/11412378.html
今日推荐