赞
踩
本文转载至:https://blog.csdn.net/u010002184/article/details/90143932
此处仅为mark,方便查看。
捣腾了半天,终于找到解决方案了,hive定时任务原表添加字段的方法
分两步,先添加字段到最后(add columns),然后再移动到指定位置(change)
alter table table_name add columns (c_time string comment '当前时间'); -- 正确,添加在最后
alter table table_name change c_time c_time string after address ; -- 正确,移动到指定位置,address字段的后面
以上基于Hive 2.0.0-SNAPSHOT,本人亲自实验的结论!!
如果添加字段时不加()会报错,网上有很多都没有(),如果写成“column”不加“s”也会报错!
alter table table_name add column c_time string comment '当前时间' after address ; -- 报错
alter table table_name add columns c_time string comment '当前时间' after address ; -- 报错
alter table table_name add columns (c_time string comment '当前时间' after address ); -- 报错
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。