Hive增加列,调整列顺序,属性名等操作 |
您所在的位置:网站首页 › hive可以删除列吗 › Hive增加列,调整列顺序,属性名等操作 |
一、hive添加字段到指定位置 先添加字段到最后位置再移动到指定位置 1、添加字段 ADD COLUMNS允许用户在当前列的末尾,分区列之前添加新的列 alter table table_name add columns (age string comment '当前时间') cascade;2、移动字段到指定位置 -- 移动在某个字段后面 alter table table_name change age age string comment '年龄' after id ;-- 移动到开头位置 alter table table_name change age age string comment '年龄' first;-- 修改字段类型 alter table table_name change column age age string;-- 替换表字段(REPLACE COLUMNS允许用户更新列,更新的过程是先删除当前的列,然后在加入新的列) 注:只有在使用native的SerDE时才可以这么做。 alter table table_name replace columns (age int comment '年龄', uage int comment '你的名字') ;3、修改表的属性 (1) 将table_n |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |